【发布时间】:2021-08-16 11:09:42
【问题描述】:
我有两个表,我正在尝试让数据导入处理程序在子实体更改时更新文档的索引。当我触发“delta-import”命令时,我得到以下信息:
{
"responseHeader":{
"status":0,
"QTime":3},
"initArgs":[
"defaults",[
"config","db-data-config.xml"]],
"command":"delta-import",
"status":"idle",
"importResponse":"",
"statusMessages":{
"Total Requests made to DataSource":"5",
"Total Rows Fetched":"3",
"Total Documents Processed":"0",
"Total Documents Skipped":"0",
"Delta Dump started":"2021-08-16 11:05:47",
"Identifying Delta":"2021-08-16 11:05:47",
"Deltas Obtained":"2021-08-16 11:05:47",
"Building documents":"2021-08-16 11:05:47",
"Total Changed Documents":"0",
"Time taken":"0:0:0.12"}}
我的数据配置是这样的:
<dataConfig>
<dataSource driver="org.mariadb.jdbc.Driver" url="jdbc:mysql://localhost:3306/eepyakm?user=root" user="root" password="root"/>
<document>
<entity name="supplier" query="select * from suppliers_tmp_view"
deltaQuery="select id from suppliers_tmp_view where last_modified > '${dataimporter.last_index_time}'"
deltaImportQuery="select * from suppliers_tmp_view where id='${dataimporter.delta.id}'">
<entity name="attachment"
query="select * from suppliers_tmp_files_view where supplier_tmp_id='${supplier.id}'"
deltaQuery="select id from suppliers_tmp_files_view where last_modified > '${dataimporter.last_index_time}'"
parentDeltaQuery="select id from suppliers_tmp_view where id='${attachment.supplier_tmp_id}'">
<field name="path" column="path" />
</entity>
</entity>
</document>
</dataConfig>
据我了解,“获取的总行数”显示子实体表中的 3 个条目已更改。那么,为什么它不索引更改的字段?
如果我执行“完全导入”,它会很好地选择更改。
【问题讨论】:
-
虽然我对 DIH 不是很熟悉,但您的两个查询都没有包含
supplier_tmp_id- 但您仍然在您的parentDeltaQuery中引用它 - 我不确定这会在何时填充它不会与文件查询一起检索。 -
在附件的查询中将“path”更改为“*”,不会改变结果,但我猜它会带来supplier_tmp_id
-
你是对的。更改 deltaQuery 以带来“id,supplier_tmp_id”而不是“id”修复它。谢谢@MatsLindh