lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nadav Har'El" <>
Subject Re: Open an IndexWriter in parallel with an IndexReader on the same index.
Date Tue, 21 Feb 2006 15:35:56 GMT
"Yonik Seeley" <> wrote on 21/02/2006 05:13:52 PM:
> On 2/21/06, Pierre Luc Dupont <> wrote:
> >     is it possible to open an IndexWriter and an IndexReader on the
> > index, at the same time,
> > to do deleteTerm and addDocument?
> No, it's not possible.  You should batch things: do all your
> deletions, close the IndexReader, then open an IndexWriter and do all
> the addDocument calls.

For some applications, the seperation of indexWriter (which can add a
document) and indexReader (which can delete a document) is very
For example, consider a case where documents are often updated, and we
often need to find and remove the old document and add the new version
of the document. the "indexModifier" class nicely hides the complexity
from us and allows both addition and deletion, but the documentation
says its performance sucks (when used in the way I just outlined):
imagine 1000 documents being modified, and now we start deleting and
adding each one, one after another.

It would have been nice if someone wrote something like indexModifier,
but with a cache, similar to what Yonik suggested above: deletions will
not be done immediately, but rather cached and later done in batches.
Of course, batched deletions should not remember the term to delete,
but rather the matching document numbers at the time of the deletion -
because after the addition of the modified document if we search for
the term again we'll find two documents.

What about this idea? Does an implementation of something similar
already exist?

Nadav Har'El

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

View raw message