lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <>
Subject Re: Updating indexes incrementaly including replacnig old documents
Date Wed, 08 Dec 2004 15:13:41 GMT
Both options are good, and which one you choose depends on which one
you feel more comfortable with, I'd say.

The searcher won't see duplicates or missing documents until it is
reopened.  So use a separate IndexSearcher for searching, and
reinstantiate it only after you are completely done with either A or B.
 At that point everything should look normal - no missing or duplicate


--- Tony Scerri <> wrote:

> Hi
> I am looking into how best to support updating of indexes
> incrementaly
> with support for replacing old documents. As I see it from what I
> have
> read and tried. There are two ways of attempting this.
> Option A
> 1)Open only a reader or search. From a list of documents to be
> updated, find all those already indexed, using an IndexReader (or
> Searcher), and get the document IDs.
> 2)For each ID delete it using an IndexReader.
> 3)Then close the reader, then open a writer, and index all the new
> documents.
> 4)Close the writer, and reopen all readers and searchers where
> necessary.
> Option B
> 1)Open only a writer and index all the documents, keeping track of
> any
> occurenct of an existing document.
> 2)Close the writer, and open a reader. Delete all updated documents.
> Continue to use the reader or searchers, reopenning to flush to disk
> if necessary.
> Would these be the two appropriate solutions, or are their better
> ways
> to do it (without creating a second index and then switching between
> them). In particular can you avoid either having duplicate records
> from option A, or missing records from option B whilst in the middle
> of the process.
> Thanks
> Tony
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message