Solr 的DIH组件,当使用delta_import时,如果entity是父子关系,那么想要子entity的修改有效,生成新索引,
首先要保证父entity的最后修改时间是在last_index_time之后的。不然即使子entity的最后修改时间在last_index_time之后,也不会生效。
<document>
<entity name="person" pk="id"
query="select id,name,descs,info from test"
deltaImportQuery="select * from test where ID='${dataimporter.delta.id}'"
deltaQuery="select id from test where last_modified > '${dataimporter.last_index_time}'">
<field column="info" name="name1"/>
<entity name="address" pk="o_id" query="select address from test2 where o_id='${test.id}'"
deltaQuery="select o_id from test2 where last_modified > '${dataimporter.last_index_time}'"
parentDeltaQuery="select ID from test where ID='${address.o_id}'">
<field name="features" column="address" />
</entity>
</entity>
</document>
如上述配置所示,如果想保证address子实体delta_import有效,就要保证父实体person的最后修改时间也要晚于last_index_time.