Solr: Indexing nested Documents via DIH

霸气de小男生 提交于 2019-12-06 13:00:43

问题


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:

  • http://yonik.com/solr-nested-objects/
  • https://cwiki.apache.org/confluence/display/solr/Uploading+Data+with+Index+Handlers

Please suggest a way to index it through DIH


回答1:


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.



来源:https://stackoverflow.com/questions/33034199/solr-indexing-nested-documents-via-dih

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!