我试图导入到Solr 5.1.0和5.2.1中,该数据配置应该生成具有以下结构的文档:Solr 5.1.0和5.2.1:使用DIH创建亲子文档使用DIH
<parentDoc>
<someParentStuff/>
<childDoc>
<someChildStuff/>
</childDoc>
</parentDoc>
从我从this question about nested entities in DIH答案的一个理解,我的Solr的版本应该可以用下面的data-config.xml
创建上面的结构:
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url=""
user=""
password=""
batchSize="-1"
/>
<document name="">
<entity rootEntity="true" name="parent" pk="parent_id" query="select * from parent">
<field column="parent_id" name="parent_id" />
<entity child="true" name="child" query="select * from child where parent_id='${parent.parent_id}'">
<field column="parent_id" name="parent_id" />
<field column="item_status" name="item_status" />
</entity>
</entity>
</document>
</dataConfig>
然而,当我执行full-import
,我得到:
<result name="response" numFound="2" start="0">
<doc>
<long name="parent_id">477</long> <!-- This is from the child -->
<str name="item_status">WS</str>
</doc>
<doc>
<long name="parent_id">477</long> <!-- This is from the parent -->
</doc>
</result>
我理解的是你应该得到5.1.0之前的非规格化布局;不过,我预计:
<result name="response" numFound="1" start="0">
<doc>
<long name="parent_id">477</long>
<doc>
<long name="parent_id">477</long>
<str name="item_status">WS</str>
</doc>
</doc>
</result>
我需要做什么来获得我想要的文档结构?我误解了DIH中的嵌套实体应该做什么?