lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject RE: indexing race condition?
Date Fri, 07 Dec 2001 22:26:41 GMT
> From: Adar, Eytan []
> I could just queue up all the delete requests and excute them 
> (once in a
> while) after I close the index.  The problem is that some of my delete
> operations are actually part of a "replace" procedure (delete 
> then add).
> Waiting on the deletes will mean that I wipe the document 
> totally from the
> index (not what I wanted).  

I think the best way handle this is only re-create the IndexReader you use
for searching when the index is in a state that you want to search.  The
index as represented by an IndexSearcher instance does not change (unless
you delete documents from it, which you shouldn't).

So you keep one IndexReader for searching.  Batch additions and deletions.
Then re-open the index used for searching when the batched additions and
deletions are complete and the index is stable.

It would be nice if delete could be implemented directly on an IndexWriter,
but internally it would have to open an IndexReader and do the same work it
does presently, so it is actually more efficient to expose this and
encourage batching.


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

View raw message