简体   繁体   English

Solr增量导入文档中实体的更改

[英]Solr delta import on changes in entity within a document

I have the following data-config: 我有以下数据配置:

<document name="locations">
    <entity pk="id" name="location" query="select * from locations WHERE isapproved='true'" 
            deltaImportQuery="select * from locations WHERE updatedate &lt; getdate() AND isapproved='true' AND id='${dataimporter.delta.id}'" 
            deltaQuery="select id from locations where isapproved='true' AND updatedate &gt; '${dataimporter.last_index_time}'">

            <!-- more document fields -->

    </entity>
    <entity pk="id" name="offerdetails" query="SELECT title AS offer_title,ISNULL(img,'') AS offer_thumb,id AS offer_id
    ,startdate AS offer_startdate
    ,enddate AS offer_enddate
    ,description AS offer_description
    FROM offers WHERE objectid=${location.id} AND objecttype=${location.objecttype} AND approved='true' AND startdate &lt; getdate() AND enddate &gt; getdate()"
    deltaImportQuery="SELECT title AS offer_title,ISNULL(img,'') AS offer_thumb,id AS offer_id
    ,startdate AS offer_startdate
    ,enddate AS offer_enddate
    ,description AS offer_description FROM offers WHERE updatedate &lt; getdate() AND approved='true' AND id='${dataimporter.delta.id}'"
    deltaQuery="SELECT id FROM offers where approved='true' AND updatedate &gt; '${dataimporter.last_index_time}'"> 
        <field name="id" column="offer_id" />
        <field name="offer_title" column="offer_title" />
        <field name="offer_thumb" column="offer_thumb" />
        <field name="offer_startdate" column="offer_startdate" />
        <field name="offer_enddate" column="offer_enddate" />
        <field name="offer_description" column="offer_description" />
    </entity>                                
    </document>

Now, when the object in the [locations] table is updated, my delta import query /dataimport?command=delta-import works perfectly. 现在,当[locations]表中的对象更新时,我的增量导入查询/dataimport?command=delta-import可以正常工作。 But when an offer is updated in the [offers] table, this is not seen by the deltaimport command. 但是,当[offers]表中的要约被更新时,deltaimport命令将看不到这一点。
Is there way to delta-import only the updated offers for the respective location if an offer is updated? 如果要约已更新,是否有办法仅增量导入各个位置的已更新要约?

And then without: 然后没有:
a. 一种。 having to fully import ALL locations 必须完全导入所有位置
or 要么
b. b。 having to update this single location and then do a regular deltaimport? 必须更新此单个位置,然后执行常规的deltaimport吗?

You tried with nested entity, so it works for only with location table because the delta query update is only based on location date update. 您尝试使用嵌套实体,所以它仅适用于位置表,因为增量查询更新仅基于位置日期更新。 Now you have to write delta query for offers and treat this as separate entity. 现在,您必须编写商品的增量查询并将其视为单独的实体。

Example: 例:

<entity pk="id" name="location" ....
  deltaImportQuery="select * ..
  deltaQuery="select ....
</entity>

<entity pk="id" name="offers" ....
  deltaImportQuery="select * ..
  deltaQuery="select ....
</entity>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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