On Wed, Jul 29, 2009 at 3:05 PM, Shai Erera<ser...@gmail.com> wrote:
> Yes of course. I meant to create an undeleteDoc variant for every deleteDoc.
> So if IndexWriter has deleteDocuments(Term), I will add
> undeleteDocuments(Term). If IndexReader has deleteDocument(int), I will add
> undeleteDocument(int).

OK.

> It is up to the caller to make sure whatever he undeletes was indeed
> deleted, i.e., if you reader.deleteDocument(4) and then
> reader.undeleteDocument(4), you should make sure that 4 represents the same
> document.

Presumably in IndexReader we can return int count (how many deleted),
but in IndexWriter it's void.

> In fact, I think it might be useful to restrict the undeleteDoc methods to
> the same reader instance with which they were deleted? It's easy to do by
> checking if deletedDocs does not contain any of the docs passed to the
> undelete method. The rational is that I believe the best use case for these
> undelete methods to be a mini "undo" of the last delete. Using the same
> reader instance you're guaranteed that the document is still "deleted"
> between delete() and undelete().

That might be too restrictive?  Ie, this is the best use case we can
picture today, but others could come up with different use cases, and
there's no technical reason for such a restriction?

undeleteAll doesn't have such a restriction.

> Also, since I can only open the index for write once, whether by IndexWriter
> or IndexReader w/ readOnly=false, we can guarantee that an undelete followed
> by delete is safe?

Or the undelete methods in IndexReader could just acquire the write lock?

Mike

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

Reply via email to