错误:“缺少必填字段"在Solr的DIH配置文件中使用嵌入式实体 [英] Error: "Missing required field" using embedded entities in Solr's DIH Configuration File
问题描述
我正在尝试使用Solr的数据导入处理程序(DIH)从MySQL数据库导入多个表. DIH不会从第二个表详细信息"中导入数据.
I am trying to import multiple tables from a MySQL database using Solr's Data Import Handler (DIH). The DIH does not import data from the second table, 'detail'.
我的数据库配置文件是
<document>
<entity name="item" pk="ListingId" query="SELECT * FROM item as item where listingid=360245270">
<entity name="detail" pk="ListingId" query="SELECT Body FROM detail where listingid='${item.listingid}'">
<field column="Body" name="Body" />
</entity>
</entity>
</document>
我监视了MySQL查询日志,执行的两个重要查询是:
I monitored the MySQL query log, and the two important queries that are executed are:
SELECT * FROM item as item where listingid=360245270
SELECT Body FROM listeditemdetail where listeditemdetail.listingid=''
很显然,配置文件中的'$ {item.listingid}'部分无法按要求工作.我为表名和列名尝试了不同的拼写,但无法正常工作.
Clearly, the '${item.listingid}' part in the configuration file is not working as required. I have tried different spellings for the table and column names but cannot get it to work.
推荐答案
(只需尝试)尝试删除主键并使用大写字母,例如:-
(Just a Try) Try removing the primary key and using the upper case e.g. :-
<document name="items">
<entity name="item" query="SELECT * FROM item as item where listingid=360245270">
<field column="LISTINGID" name="listingid" />
<entity name="detail" query="SELECT Body FROM detail where listingid='${item.LISTINGID}'">
<field column="Body" name="Body" />
</entity>
</entity>
</document>
这篇关于错误:“缺少必填字段"在Solr的DIH配置文件中使用嵌入式实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!