The changes made by a IndexWriter since the last commit() will be undone if you close it with IndexWriter#rollback().

Afaik using IndexReader#undeleteAll to undo previously done deletes is a very bad way as it will not only undelete the documents deleted by the current IndexReader but all deleted documents that haven't been purged out of the index.

Am 23.05.2013 22:07, schrieb ikoelli...@axsone.com:
What about undeleteAll? Is there an equivalent on the IndexWriter side?

-----Original Message-----
From: Uwe Schindler [mailto:u...@thetaphi.de]
Sent: Thursday, May 23, 2013 4:01 PM
To: java-user@lucene.apache.org
Subject: Re: Lucene 3.6.2 deleteDocument(docNum) and undeleteAll

Use delete by query in IndexWriter. No need to use IndexSearcher.



ikoelli...@axsone.com schrieb:
Hello,
We have code running with Lucene 2.9.4 that does the following:


1.       Check that number of documents to be deleted, found with a
particular query, matches the expected number we pass in

2.       For each ScoreDoc in the ScoreDoc[] returned from the search
we call deleteDocument(scoreDocs[i].doc) each iteration checking that
our program has not been asked to shut down.

3.       If there was an error we call undeleteAll() to rollback any
deletes that have already been done

In Lucene 3.6.2 the IndexReader delete* methods are deprecated since
the logic is being moved to the IndexWriter in 4.x, but there does not
seem to be similar methods implemented on the IndexWriter side. What is
the appropriate way that we should be doing these deletes and undeletes
in order to provide the same level of functionality?
--
Uwe Schindler
H.-H.-Meier-Allee 63, 28213 Bremen
http://www.thetaphi.de

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



---------------------------------------------------------------------
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