lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Serebrennikov <>
Subject Re: Deleting a document with an IndexWriter open
Date Mon, 19 Jul 2004 22:23:08 GMT
Doug Cutting wrote:

> Dmitry Serebrennikov wrote:
>> So here's a modified sequence of operations, perhaps a bit more 
>> efficient than proposed by Christoph:
>> 1) Open an IndexReader for searching - S. Keep it open until the 
>> transaction is committed.
>> 2) Open a second IndexReader for deletions - D.
>> 3) Create a filter bitset F (or use any other mechanism for storing 
>> document numbers to be deleted)
>> 4) Open an IndexWriter for new documents - W.
>> 5) As documents come in, add them using W. Find their old versions in 
>> D and record their document numbers in F. D will not show any new 
>> documents, only documents present at the time D was created.
>> 6) Close W.
>> 7) Use D to delete all documents marked in F.
>> 8) Close D.
> What happens if there are deletions in S and D, and then, in step 5, 
> as documents are added to W and segments are merged, documents are 
> renumbered?  Wouldn't that invalidate F?  Currently we don't permit 
> one to delete documents from an IndexReader while an IndexWriter is 
> open, to prevent this sort of thing.  Am I missing something?

I was assuming that there would never be deletions in S. As far as D, 
since it was opened prior to W, I thought that would guarantee that it 
would not be affected by anything done in W, including optimizations.
Ok, I think I see the point of confusion. I wasn't suggesting that 
documents are actually deleted in step 5. Instead their doc ids are 
recorded for later deletion. Actual deletion occurs in step 7, after W 
is closed in 6. So, since S is never used for deletion, we have only one 
writer (W) or one reader with deletes (D) open at a time. I think this 
should work. No?


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

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

View raw message