Error: “Missing required field” using embedded entities in Solr's DIH Configuration File

╄→гoц情女王★ 提交于 2019-12-12 00:56:17

问题


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'.

My database configuration file is

<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>

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=''

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.


回答1:


(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>


来源:https://stackoverflow.com/questions/13371630/error-missing-required-field-using-embedded-entities-in-solrs-dih-configurat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!