<br />
<b>Warning</b>:  Undefined array key "global_protection_id" in <b>/home/wikitechy/public_html/interview-questions/wp-content/plugins/content-protector/inc/class-ps-rest-handler.php</b> on line <b>51</b><br />
{"id":240,"date":"2021-07-12T14:56:17","date_gmt":"2021-07-12T14:56:17","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=240"},"modified":"2021-09-14T10:20:23","modified_gmt":"2021-09-14T10:20:23","slug":"how-to-index-multiple-tables-using-solr","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/","title":{"rendered":"How to Index multiple tables using SOLR ?"},"content":{"rendered":"<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"index-multiple-tables-using-solr\" class=\"color-purple\" style=\"text-align: justify;\">Index multiple tables using SOLR<\/h2>\n<\/div>\n<\/div>\n<div class=\"row\" style=\"text-align: justify;\">\n<div class=\"col-sm-12\">\n<p>There are various ways to do it and it depends on your table schema. Some simple ones would be like:<\/p>\n<div class=\"Content\">\n<div class=\"hddn\">\n<ul>\n<li>If you have 2-3 different tables and they are kind of unrelated then in that case you need to have an extensive Solr schema and just index each table separately. You would perform this only when you desire to use Solr for just search on documents present in dissimilar tables.<\/li>\n<li>It\u2019s like you have a table STUDENT (id,name,roll) and TEACHER (id,name,subject,qualification), you need to have these fields in your solr schema (id,name,roll,subject,qualification).<\/li>\n<li>Now index the two tables either by solrj or use Data Import Handler.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"Content\">\n<div class=\"hddn\">\n<ul>\n<li>If you have different tables and have relations between them then you need to write SQL queries which perform joins between them and get the columns that you would like to index into solr.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p>Indexing either of the two tables (and not both the tables):<\/p>\n<div class=\"subheading\">\n<h2 id=\"db-config-xml\">DB-config.xml<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-markdown code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markdown code-embed-code\">&lt;dataConfig&gt;<br\/>&lt;dataSource driver=&quot;com.metamatrix.jdbc.MMDriver&quot; url=&quot;jdbc:.....&quot; \/&gt;<br\/>&lt;document name=&quot;doc&quot;&gt;<br\/>&lt;entity name=&quot;table1&quot;<br\/>query=&quot;select * from table1&quot;&gt;<br\/>&lt;field column=&quot;ID&quot; name=&quot;ElementID&quot; \/&gt;<br\/>&lt;field column=&quot;Name&quot; name=&quot;ElementName&quot; \/&gt;<br\/>&lt;field column=&quot;ElementType&quot; name=&quot;ElementType&quot; \/&gt;<br\/>&lt;field column=&quot;RepId&quot; name=&quot;ElementRepId&quot; \/&gt;<br\/>&lt;\/entity&gt;<br\/><br\/>&lt;entity name=&quot;table2&quot;<br\/>query=&quot;select * from table2&quot;&gt;<br\/>&lt;field column=&quot;id&quot; name=&quot;ElementPropertyID&quot; \/&gt;<br\/>&lt;field column=&quot;Name&quot; name=&quot;ElementPropertyName&quot; \/&gt;<br\/>&lt;field column=&quot;DataType&quot; name=&quot;ElementPropertyDataType&quot; \/&gt;<br\/>&lt;field column=&quot;RepId&quot; name=&quot;ElementPropertyRepId&quot; \/&gt;<br\/><br\/>&lt;\/entity&gt;<br\/>&lt;\/document&gt;<br\/>&lt;\/dataConfig&gt;<\/code><\/pre> <\/div>\n<\/div>\n<div class=\"subheading\">\n<h2 id=\"schema-xml\">Schema.xml<\/h2>\n<\/div>\n<div class=\"CodeContent\">\n<div class=\"hddn\">\n<figure class=\"highlight\"><div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-markdown code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markdown code-embed-code\">&lt;fields&gt;<br\/><br\/>&lt;field name=&quot;ElementID&quot; type=&quot;string&quot; indexed=&quot;true&quot;<br\/>stored=&quot;true&quot; \/&gt;<br\/>&lt;field name=&quot;ElementName&quot; type=&quot;string&quot; indexed=&quot;true&quot;<br\/>stored=&quot;true&quot; \/&gt;<br\/>&lt;field name=&quot;ElementType&quot; type=&quot;string&quot; indexed=&quot;true&quot;<br\/>stored=&quot;true&quot; \/&gt;<br\/>&lt;field name=&quot;ElementRepId&quot; type=&quot;string&quot; indexed=&quot;true&quot;<br\/>stored=&quot;true&quot; \/&gt;<br\/><br\/>&lt;field name=&quot;ElementPropertyID&quot; type=&quot;string&quot; indexed=&quot;true&quot;<br\/>stored=&quot;true&quot; \/&gt;<br\/>&lt;field name=&quot;ElementPropertyName&quot; type=&quot;string&quot; indexed=&quot;true&quot;<br\/>stored=&quot;true&quot; \/&gt;<br\/>&lt;field name=&quot;ElementPropertyDataType&quot; type=&quot;string&quot;<br\/>indexed=&quot;true&quot; stored=&quot;true&quot; \/&gt;<br\/>&lt;field name=&quot;ElementPropertyRepId&quot; type=&quot;string&quot; indexed=&quot;true&quot;<br\/>stored=&quot;true&quot; \/&gt;<br\/><br\/><br\/>&lt;dynamicField name=&quot;*&quot; type=&quot;ignored&quot; \/&gt;<br\/>&lt;\/fields&gt;<\/code><\/pre> <\/div><\/figure>\n<\/div>\n<\/div>\n<div class=\"CodeContent\">\n<div class=\"hddn\">\n<figure class=\"highlight\"><div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-markdown code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markdown code-embed-code\">&lt;uniqueKey&gt;ElementPropertyID&lt;\/uniqueKey&gt;<\/code><\/pre> <\/div><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Answer:If you have 2-3 different tables and they are kind of unrelated then in that case you need to have an extensive<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"passster_activate_protection":false,"passster_protect_child_pages":"","passster_protection_type":"password","passster_password":"","passster_activate_overwrite_defaults":"","passster_headline":"","passster_instruction":"","passster_placeholder":"","passster_button":"","passster_id":"","passster_activate_misc_settings":"","passster_redirect_url":"","passster_hide":"no","passster_area_shortcode":"","gtb_hide_title":false,"gtb_wrap_title":false,"gtb_class_title":"","gtb_remove_headerfooter":false,"footnotes":""},"categories":[684],"tags":[195,811,823,799,813,787,687,821,820,804,790,808,703,822,491,203,199,214,198,363,209,205,222,812,800,196,212,810,712,213,710,207,711,366,361,204,282,367,206,801,816,819,814,818,817,788,815,809,200,197,280,364,713,285],"class_list":["post-240","post","type-post","status-publish","format-standard","hentry","category-apache-solr","tag-accenture-interview-questions-and-answers","tag-apache-interview-questions","tag-apache-interview-questions-and-answers","tag-apache-interview-questions-and-answers-for-experienced","tag-apache-multi-core","tag-apache-real-time-interview-questions","tag-apache-solr","tag-apache-solr-example-application","tag-apache-solr-indexing","tag-apache-solr-interview-questions","tag-apache-solr-performance","tag-apache-solr-requirements","tag-apache-solr-tutorial","tag-apache-solr-tutorial-for-beginners","tag-applied-materials-interview-questions-and-answers","tag-capgemini-interview-questions-and-answers","tag-casting-networks-india-pvt-limited-interview-questions-and-answers","tag-cgi-group-inc-interview-questions-and-answers","tag-chetu-interview-questions-and-answers","tag-ciena-corporation-interview-questions-and-answers","tag-collabera-technologies-interview-questions-and-answers","tag-dell-international-services-india-pvt-ltd-interview-questions-and-answers","tag-flipkart-interview-questions-and-answers","tag-how-solr-indexing-works","tag-hybris-solr-interview-questions","tag-ibm-interview-questions-and-answers","tag-indecomm-global-services-interview-questions-and-answers","tag-index-multiple-tables-in-solr","tag-indiabulls-technology-solutions-ltd-interview-questions-and-answers","tag-infosys-technologies-interview-questions-and-answers","tag-mavenir-interview-questions-and-answers","tag-mphasis-interview-questions-and-answers","tag-nagarro-software-pvt-ltd-interview-questions-and-answers","tag-netapp-interview-questions-and-answers","tag-opentext-technologies-interview-questions-and-answers","tag-oracle-corporation-interview-questions-and-answers","tag-persistent-systems-interview-questions-and-answers","tag-rbs-india-development-centre-pvt-ltd-interview-questions-and-answers","tag-sap-labs-india-pvt-ltd-interview-questions-and-answers","tag-solr-admin-interview-questions","tag-solr-multicore","tag-solr-multicore-example","tag-solr-multiple-indexes","tag-solr-multiple-schemas","tag-solr-multivalued-field-example","tag-solr-questions-and-answers","tag-solr-search-multiple-collections","tag-solr-search-multiple-tables","tag-tech-mahindra-interview-questions-and-answers","tag-unitedhealth-group-interview-questions-and-answers","tag-virtusa-consulting-services-pvt-ltd-interview-questions-and-answers","tag-wells-fargo-interview-questions-and-answers","tag-wm-global-technology-services-india-pvt-ltd-interview-questions-and-answers","tag-xoriant-solutions-pvt-ltd-interview-questions-and-answers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Index multiple tables using SOLR ? - Apche Solr Interview Question<\/title>\n<meta name=\"description\" content=\"How to Index multiple tables using SOLR ? - apache solr interview questions and answers - If you have 2-3 different tables and they are kind of unrelated\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Index multiple tables using SOLR ? - Apche Solr Interview Question\" \/>\n<meta property=\"og:description\" content=\"How to Index multiple tables using SOLR ? - apache solr interview questions and answers - If you have 2-3 different tables and they are kind of unrelated\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-12T14:56:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-14T10:20:23+00:00\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/\",\"name\":\"How to Index multiple tables using SOLR ? - Apche Solr Interview Question\",\"isPartOf\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\"},\"datePublished\":\"2021-07-12T14:56:17+00:00\",\"dateModified\":\"2021-09-14T10:20:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"How to Index multiple tables using SOLR ? - apache solr interview questions and answers - If you have 2-3 different tables and they are kind of unrelated\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Index multiple tables using SOLR ? - Apche Solr Interview Question","description":"How to Index multiple tables using SOLR ? - apache solr interview questions and answers - If you have 2-3 different tables and they are kind of unrelated","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/","og_locale":"en_US","og_type":"article","og_title":"How to Index multiple tables using SOLR ? - Apche Solr Interview Question","og_description":"How to Index multiple tables using SOLR ? - apache solr interview questions and answers - If you have 2-3 different tables and they are kind of unrelated","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/","og_site_name":"Wikitechy","article_published_time":"2021-07-12T14:56:17+00:00","article_modified_time":"2021-09-14T10:20:23+00:00","author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/","name":"How to Index multiple tables using SOLR ? - Apche Solr Interview Question","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"datePublished":"2021-07-12T14:56:17+00:00","dateModified":"2021-09-14T10:20:23+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"How to Index multiple tables using SOLR ? - apache solr interview questions and answers - If you have 2-3 different tables and they are kind of unrelated","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/apache-solr\/how-to-index-multiple-tables-using-solr\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=240"}],"version-history":[{"count":3,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/240\/revisions"}],"predecessor-version":[{"id":3720,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/240\/revisions\/3720"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}