我在data-config.xml中有以下内容:
<dataConfig>
<dataSource dataSource info"/>
<document>
<entity name="item"
pk="itemid"
query=" SELECT itemid,start,end,item_categoryid
FROM item"
deltaImportQuery=" SELECT * FROM item
WHERE itemid = '${dataimporter.delta.item_id}'"
deltaQuery=" SELECT itemid
FROM item
WHERE last_mod > '${dataimporter.last_index_time}'
OR create_time> '${dataimporter.last_index_time}'">
<field column="itemid" name="item_id"/>
<field column="start" name="start"/>
<field column="end" name="end"/>
<entity name="item_category"
pk="item_categoryid"
query=" SELECT item_categoryid,desc,title
FROM item_category
WHERE mbpostingid='${item.item_categoryid}'"
deltaImportQuery=" SELECT * FROM item_category
WHERE item_categoryid= '${dataimporter.delta.id}'"
deltaQuery="SELECT item_categoryid
FROM item_category
WHERE last_mod > '${dataimporter.last_index_time}'
OR create_time > '${dataimporter.last_index_time}'">
<field column="item_categoryid" name="id"/>
<field column="desc" name="desc"/>
<field column="title" name="title"/>
</entity>
</entity>
</document>
</dataConfig>
每当我运行delta-import
时 http://localhost:8983/solr/dataimport?command=delta-import
Solr正在更新已在我的数据库中更新的行,但它没有为已添加的行添加索引,也没有为已删除的索引删除索引。
Solr识别(提取)我新添加的行到我的数据库,但它没有“处理”它们
<str name="Total Documents Processed">0</str>
我的dataConfig有什么问题吗?我有什么可以做的吗?
谢谢, 迦勒
答案 0 :(得分:1)
query="SELECT itemid,start,end,item_categoryid
FROM item"
deltaImportQuery="SELECT * FROM item
WHERE itemid = '${dataimporter.delta.item_id}'"
^-----^
我们必须在变量中使用确切的列名。在我看来,列名是itemid
(没有下划线),所以你应该尝试一下:
query="SELECT itemid,start,end,item_categoryid
FROM item"
deltaImportQuery="SELECT * FROM item
WHERE itemid = '${dataimporter.delta.itemid}'"
^----^
答案 1 :(得分:0)
尝试
deltaImportQuery="SELECT * FROM item
WHERE itemid = '${dih.delta.item_id}'"
http://wiki.apache.org/solr/DataImportHandler说:
deltaImportQuery :(仅用于delta-import)。如果不存在,DIH会尝试通过(在识别delta之后)修改“查询”来构造导入查询(这很容易出错)。有一个命名空间 $ {dih.delta.column-name} ,可以在此查询中使用。例如:select * from tbl,其中id = $ {dih.delta.id}
答案 2 :(得分:0)
<entity name="searchitemcontent" pk="itemid"
query="select skuid, noofsupp, membership, isnull(negotiable,0) as negotiable from searchskumaster skm "
deltaImportQuery="select skuid, skuname, combineskuname,Category, Product, Brand, Price, discount, url, image, itemstatus , supplierid,itemid, marketprice,mwsimage, pricestatus, isservice ,suppliername, noofsupp, membership, isnull(negotiable,0) as negotiable from
searchskumaster skm where itemid='${dih.delta.itemid}'"
deltaQuery="select itemid from searchskumaster where modifieddate > '${dataimporter.last_index_time}'"
deletedPkQuery="SELECT itemid FROM searchskumaster where isdeleted=1 and modifieddate > '${dataimporter.last_index_time}' ">
注意:选择 itemid 。在deltaQuery
和deltaImportQuery
查询中, itemid ='$ {dih.delta。 itemid },在两个查询中,itemid应为同名