lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Kaser <>
Subject Re: Newbie Questions
Date Wed, 10 Aug 2016 07:15:14 GMT
There is no way to "update" a document in lucene, you always have to 
remove the existing document and add the updated version with ALL its 
fields. The updateDocument-method of IndexWriter exists only for 
convenience (and to assure the operation is atomic), but internally it 
does just that: remove the old document and add a new one.
In generally, this works best if you get all fields of the document from 
your external datasource instead of the index, because depending on your 
field configuration, there might be some information missing (especially 
for fields that are not STORED or DocValues).

See also the Lucene FAQ:


Am 09.08.2016 um 20:51 schrieb lukes:
> Thanks for the reply.
>    Is there a way to partially update the document ? I know there's a API
> updateDocument on IndexWriter, but that seems to create a new document with
> just a field i am specifying. What i want is delete some fields from
> existing(indexed) document, and then add some new fields(could or not be
> same). Alternatively i tried to search for the document, and then calling
> removeFields and finally updateDocument, but now any search after the above
> process is not able for find that document(I created the new IndexReader).
> Am i missing anything ?
> Regards.
> --
> View this message in context:
> Sent from the Lucene - Java Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message