lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Goller <gol...@detego-software.de>
Subject Re: Deleting a document with an IndexWriter open
Date Fri, 16 Jul 2004 13:03:46 GMT
Christiaan Fluit wrote:
> Christoph Goller wrote:
> 
>> 1) Keep an IndexReader/Searcher open on your index in order to guarantee
>> reed access and a consistent index during the whole process.
>>
>> 2) Open a new IndexReader and delete all the documents that you want to
>> update.
>>
>> 3) Close the IndexReader (makes the deletions visible for any new
>> readers/writers but not for the still opened Searcher/Reader).
> 
> 
> But what happens when a query evaluated by the IndexReader/IndexSearcher 
> mentioned in (1) results in a hit that has already been deleted by the 
> second IndexReader? I.e. you try to access a document through one 
> IndexReader that has already been deleted by another IndexReader.
> 
> I would expect some kind of exception because the document data can no 
> longer be found, or am I missing something? I hope I am because your 
> solution does sound very attractive ;)

The IndexReader opened in 1 keeps a copy of his version of the index
until he is closed. This means he will never see any changes made by
another reader or a writer.


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message