Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr, block updating of existing document

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?

like image 469
Alexander Avatar asked Dec 13 '11 19:12

Alexander


1 Answers

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.

like image 84
javanna Avatar answered Oct 03 '22 04:10

javanna