lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <paul.elsc...@xs4all.nl>
Subject Re: searching while indexing.
Date Wed, 05 Jan 2005 13:42:10 GMT
On Wednesday 05 January 2005 12:14, Morus Walter wrote:
> Peter Veentjer - Anchor Men writes:
> > >>Is your IndexReader doing deletes?  
> > Yes.. I have to remove the documents I`m going to update from the
> > Reader. 
> > 
> > >>That is the only time it locks the index (because that is essentially 
> > >>a write operation).  If you're purely searching with the reader it 
> > >>should work fine with a writer concurrently.
> > 
> > Ok, I understand why there are problems. But how can I fix this problem?
> > I have to update documents, so how can I do this without deleting
> > documents from the Reader? I don`t want to add the same document twice. 
> > 
> You have to bundle all writes at one point and serialize deletions and
> imports.
> That is:
> open a reader for deleting
> delete the documents to be deleted
> close that reader
> open a writer for adding content
> add documents
> close that writer
> begin at start.
> 
> It's up to you, whether you open a reader to delete single documents and
> a writer for adding a single document or use batches of several documents,
> but you cannot escape the need to serialize the writes.

And while this updating is going on, you can keep another reader open for
searching, it will not be affected by the updates.
After all updates are done, close that reader and reopen
another one to see the updates.

Regards,
Paul Elschot


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


Mime
View raw message