Solr:通过DIH索引嵌套文档 [英] Solr: Indexing nested Documents via DIH

查看:95
本文介绍了Solr:通过DIH索引嵌套文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 DIH 将我的文档从 MySql 索引到 Solr 。我有这样的表结构

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


  • 表用户

  • Table User

< kbd>
id

1

2

3

name

Jay

Chakra

Rabbit

地址


id

1

< kbd> 2


3

number

1111111111

2222222222

3333333333

email < br>
test@email.com

test123@test.co

unique @ email .com

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

和其他关联。

我想在嵌套文档结构中对此进行索引,但无法找到任何可以使用DIH完成的资源。

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

参考资源:

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

请建议一种方法来索引它 DIH

Please suggest a way to index it through DIH

推荐答案

此功能已由 SOLR-5147 ,应该可用于Solr 5.1+

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

这是一个从原始Jira票证中获取的示例配置。

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>

请注意 child =true 子实体需要。

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

这篇关于Solr:通过DIH索引嵌套文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆