lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@lucene.com>
Subject Re: Incremental indexing
Date Fri, 06 Dec 2002 23:19:14 GMT
Eric Jain wrote:
> Currently, I use the following procedure to update an index incrementally:
> 
>     1. Build document
>     2. Open index reader
>     3. Delete any previous version of the document using a key field
>     4. Close index reader
>     5. Open index writer
>     6. Add document to index
>     7. Close index writer
> 
>     Repeat
> 
> 
> Any ideas how this could be accomplished more efficiently AND easier?

More efficiently, yes.  Easier, no.

If you know you're going to update multiple documents, then the fastest 
approach is to batch things, e.g.:
   1. Open reader;
   2. Delete all old documents;
   3. Close reader;
   4. Open writer;
   5. Add all new documents;
   6. Close writer.

If, before step one, you open another IndexReader, then you can continue 
to use it for searches while the update is in progress.  If you then, 
after step six, open a new IndexReader to use for searches, then no 
searches will ever see the intermediate state when documents have been 
deleted but not yet re-added.

Doug


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


Mime
View raw message