Peymankh
Peymankh

Reputation: 2046

Updating LuceneIndex entry in Java

I'm using lucene indexes for a search feature in an application in Java. Deleting and inserting a new entry in lucene indexes are pretty straight forward, but does anyone know how to update an lucene index entry?

For example the lastname of a person at the moment is "Doe", when I change that to "Doe 1" in my DB, I'll need to update my indexes as well.

The only thing that seems feasible right now is deleting that entry and inserting a new one. But is there any other option for that?

Upvotes: 1

Views: 1231

Answers (1)

stzoannos
stzoannos

Reputation: 938

As mentioned in Lucene wiki, http://wiki.apache.org/lucene-java/LuceneFAQ#How_do_I_update_a_document_or_a_set_of_documents_that_are_already_indexed.3F, this is not possible:

"There is no direct update procedure in Lucene. To update an index incrementally you must first delete the documents that were updated, and then re-add them to the index."

Upvotes: 2

Related Questions