0

Possible Duplicate:
Why Lucene doesn't support any type of update to an existing document

Is it possible to update stored field value after document was indexed(without reindexing it)?

Community
  • 1
  • 1
user1678487
  • 43
  • 1
  • 5

1 Answers1

3

Short answer: No.

You need to delete and re-add the document, it's stored fields and it's indexed fields. See IndexWriter.updateDocument() Javadoc:

"Updates a document by first deleting the document(s) containing term and then adding the new document. The delete and then add are atomic as seen by a reader on the same index (flush may happen only after the add)."

One more alternative could be to store any data that needs updating outside of Lucene (say in a relational DB).

There's all sorts of work in progress to allow in place updates, to stored or index fields, however nothing concrete for Lucene V4 or earlier.

Gili Nachum
  • 5,288
  • 4
  • 31
  • 33