Vinubalaji Gopal wrote:
On Wed, Feb 11, 2009 at 2:56 AM, Michael McCandless
<luc...@mikemccandless.com> 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
your
own search to find out whether doc exists or not, then always use update
since that's what update's doing too.
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org