简体   繁体   中英

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

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.

(Just a Try) Try removing the primary key and using the upper case eg :-

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM