lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: deletes when the writer is open and autocommit is set to false
Date Wed, 11 Feb 2009 16:50:00 GMT

Vinubalaji Gopal wrote:

> On Wed, Feb 11, 2009 at 2:56 AM, Michael McCandless
> <> wrote:
>> IndexWriter can in fact delete documents, by Term or by Query.  It  
>> also has
>> updateDocument, which under-the-hood simply calls deleteDocuments  
>> then
>> addDocument.
> Awesome that FAQ entry confused me and I didn't look at IndexWriter
> javadoc thinking that it wouldn't be there since deleteDocument is
> there in IndexReader.

Hmm -- OK I just fixed that FAQ entry.  Thanks for raising this!

> What is the best way to update a document? Search and do an update if
> the document is found/else insert or just try an update whatever be
> the case - the update will delete in case a document exists or will
> just insert a new document if the document doesn't exist in the index.

If you know the doc doesn't exist already, you gain some performance by
using add instead of update.  But if performance is already fast  
enough, it
may be simpler to just always use update.  Or, if you will have to do  
own search to find out whether doc exists or not, then always use update
since that's what update's doing too.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message