lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: The best way to stop indexing quickly?
Date Mon, 10 May 2010 11:29:10 GMT
One way would be to identify the most recently added document, save
that info somewhere, and close the IndexWriter as normal.  Then, when
you restart the indexing of the file, skip ahead and start from the
last indexed document.   Or skip the identify/save bit if your
indexing app already has code to avoid indexing duplicate docs.

Alternatively, open the IndexWriter with autocommit=false and call
rollback() when shutdown requested.

The first method will cause the file to be partially indexed and
should be very quick.  The second method will cause the file not to be
indexed, but I guess could be slower if there is a lot of data to
rollback.

As to which is best - you decide.  I'm sure there are other ideas too.

If by "damage" you mean corruption, you should be safe whatever you
do.  Lucene is very good at keeping indexes in a consistent state.


--
Ian.


On Mon, May 10, 2010 at 10:26 AM, alx27 alx27 <alx27alx@gmail.com> wrote:
> Hi all,
>
> Imagine a situation: Lucene started indexing a huge file, and just after
> this user demands the application to be shut down immediately. What would be
> the recommended way of doing this, so that application shuts down within
> seconds, but with least possible damage to the index?
>
> best regards,
> Alex
>

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


Mime
View raw message