Yes, IndexWriter.updateDocument() deletes and then adds. See the
javadocs.  So your index will have deleted docs.  Why do you care?
They'll go away eventually as segments get merged.

If you really do care, see IndexWriter,forceMergeDeletes().  See also
the javadoc for that: This is often a horribly costly operation;
rarely is it warranted.


--
Ian.


On Wed, Oct 17, 2012 at 1:52 PM, Deepak Shakya <just...@gmail.com> wrote:
> I am using updateDocument() method to update my document in the lucene
> index. Here is how I am doing it.
>
> writer.updateDocument(new Term(Constants.DOC_ID_FIELD,
> doc.get(Constants.DOC_ID_FIELD)), doc);
>
> I check my index data with Luke, and find that on second run of the
> indexing, Luke tells that Deleted Document - not available. So basically,
> the document is marked as deleted, but it still resides in the index.
>
> I don't want to keep these marked deleted documents. Am I doing it wrong?
>
> Also, my understanding was that, when I am updating the document, it
> deletes the old one and then adds the new one. Is that not the case?
>
> --
> With Regards,
> Deepak Shakya

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to