【问题标题】:Solr delta import on changes in entity within a documentSolr 增量导入文档中实体的更改
【发布时间】:2015-03-28 01:37:51
【问题描述】:

我有以下数据配置:

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

现在,当[locations] 表中的对象更新时,我的增量导入查询/dataimport?command=delta-import 可以完美运行。 但是,当 [offers] 表中的商品更新时,deltaimport 命令不会看到这一点。
如果更新了报价,是否可以仅增量导入相应位置的更新报价?

然后没有:
一种。必须完全导入所有位置
或
湾。必须更新这个单一位置,然后执行常规 deltaimport?

【问题讨论】:

    标签: solr import delta


    【解决方案1】:

    您尝试使用嵌套实体,因此它仅适用于位置表,因为增量查询更新仅基于位置日期更新。 现在您必须为报价编写增量查询并将其视为单独的实体。

    例子:

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

    【讨论】:

    • 好的,我根据您的建议更新了我的data-config.xml...但它仍然不起作用...为什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多