Solr, block updating of existing document

别等时光非礼了梦想. 提交于 2020-01-02 06:40:34

问题


When a document is sent to solr and such document already exists in the index (by its ID) then the new one replaces old one.

But I don't want to automatically replace documents. Just ignore and proceed to the next. How can I configure solr.

Of course I can query solr to check if it has the document already but it's bad for me since I do bulk updates and this will complicate the process and increase amount of request.

So are there any ways to configure solr to ignore duplicates?


回答1:


You can disable the automatic overwriting of documents with the same uniqueIndex specifying the attribute overwrite="false" within the add element while you send documents to the UpdateHandler. Have a look here.

<add overwrite="false">
    <doc>
        <field name="id">id</field>
    </doc>
</add>

Anyway this allows to have duplicate documents into solr, instead of skipping new documents with same id of existing ones. I don't think this is your desired behaviour.

I think you should write your own UpdateHandler or UpdateRequestProcessor or follow the suggestions you got from the solr user mailing list.



来源:https://stackoverflow.com/questions/8494923/solr-block-updating-of-existing-document

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