1

I want to index my document from MySql to Solr via DIH. I have a table structure like this

  • Table User

    id
    1
    2
    3
    name
    Jay
    Chakra
    Rabbit

  • Address

    id
    1
    2
    3
    number
    1111111111
    2222222222
    3333333333
    email
    test@email.com
    test123@test.co
    unique@email.com

and other associations.

I want to index this in a nested document structure but unable to find any resource via which it can be done using DIH.

Resources refered:

Please suggest a way to index it through DIH

Jay Chakra
  • 1,481
  • 1
  • 13
  • 29

1 Answers1

2

This feature has been implemented by SOLR-5147 and should be available for Solr 5.1+

Here is a sample configuration taken from the original Jira ticket.

<dataConfig>
  <dataSource type="JdbcDataSource" />
  <document>
    <entity name="PARENT" query="select * from PARENT">
      <field column="id" />
      <field column="desc" />
      <field column="type_s" />
      <entity child="true" name="CHILD" query="select * from CHILD where parent_id='${PARENT.id}'">
        <field column="id" />
        <field column="desc" />
        <field column="type_s" />
      </entity>
    </entity>
  </document>
</dataConfig>

note the child="true" is required for child entities.

leoh
  • 10,378
  • 7
  • 28
  • 39
  • This a config set for solr-data-config.xml I am unable to write the corresponding schema. Can you post the corrosponding Schema? – Jay Chakra Oct 10 '15 at 12:14
  • There wasn't a requirement for the schema to index nested documents. More details and walk through can be found from yonik's post: http://yonik.com/solr-nested-objects/ – leoh Oct 12 '15 at 16:25