title: Keep relational database structure in solr index?
body: <p>I was able to import data through solr DIH.</p>
  
  <p>In my database I have 4 tables:</p>
  
  <pre><code>threads: id, user_id, country_id
  
  tags: id
  
  thread_tag_map: thread_id, tag_id
  
  countries: id
  
  posts: id, thread_id
  </code></pre>
  
  <p>I want each document in solr to consist of:</p>
  
  <pre><code>thread_id
  tag_id
  country_id
  post_id
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>thread_id: 1
  tag_id: 23
  tag_id: 34
  country_id: 43
  post_id: 4
  post_id: 23
  post_id: 23
  </code></pre>
  
  <p>How should I map it?</p>
  
  <p>I haven't been able to configure data-config.xml for this. I have followed the DIH tutorial without success.</p>
  
  <p>Here is my schema.xml:</p>
  
  <pre><code>&lt;schema name="example" version="1.2"&gt;
    &lt;types&gt;
      &lt;fieldType name="string" class="solr.StrField" sortMissingLast="true"/&gt;
      &lt;fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/&gt;
      &lt;fieldType name="uuid" class="solr.UUIDField" indexed="true" /&gt;
      &lt;fieldType name="text_rev" class="solr.TextField" positionIncrementGap="100"&gt;
        &lt;analyzer type="index"&gt;
          &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
          &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /&gt;
          &lt;filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="0"/&gt;
          &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
          &lt;filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
             maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/&gt;
        &lt;/analyzer&gt;
        &lt;analyzer type="query"&gt;
          &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
          &lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
          &lt;filter class="solr.StopFilterFactory"
                  ignoreCase="true"
                  words="stopwords.txt"
                  enablePositionIncrements="true"
                  /&gt;
          &lt;filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0"/&gt;
          &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
        &lt;/analyzer&gt;
      &lt;/fieldType&gt;
   &lt;/types&gt;
  
  
   &lt;fields&gt;
     &lt;field name="id" type="uuid" indexed="true" stored="true" default="NEW"/&gt;
     &lt;field name="threads.title" type="text_rev" indexed="true" stored="true"/&gt;
     &lt;field name="posts.body" type="text_rev" indexed="true" stored="true"/&gt;
     &lt;dynamicField name="*id" type="int" indexed="false" stored="true"/&gt;
   &lt;/fields&gt;
  
  &lt;uniqueKey&gt;id&lt;/uniqueKey&gt;
  
   &lt;defaultSearchField&gt;posts.body&lt;/defaultSearchField&gt;
  
   &lt;solrQueryParser defaultOperator="OR"/&gt;
  &lt;/schema&gt;
  </code></pre>