lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: write lock: cleaning an index
Date Sun, 25 Jul 2004 06:31:39 GMT
Uh, that's rough on IndexWriter, killing it like that. :(  One simple
solution to your problem may be gentler with IndexWriter, and design
your application in a way that will allow you to notify it when you
want to stop indexing and close IndexWriter.  One frequently used and
simple approach is to use the file system as your messaging mechanism.

To the application that uses IndexWriter, add a bit of code that
periodically looks for some file (e.g. stop-indexing).  Then add a bit
of logic around IndexWriter that will allow you to close it.  Combine
the two and you will be able to close IndexWriter with its close()
method when you create that stop-indexing file in the file system. 
This way you won't be leaving any locks behind, and there will be no
danger of corrupting the index.  Don't remember to remove the
stop-indexing file before re-starting your indexing application.


Otis


--- Ravi Rao <rrao@alterpoint.com> wrote:
> All,
> 
> I have an application that has one IndexWriter.  Once in a while the
> enclosing application is taken down with a kill and IndexWriter
> leaves
> a lock file behind.  Other than removing the lock file, is there
> anything else I can do to clean the index.
> 
> The only general solution I can think of is to index to a temporary
> index and then every so often merge it with the master index, which
> cannot be allowed to be corrupted.  In this scheme we lose only the
> temporary index rather than the master index.
> 
> Many thanks,
> -- 
> Ravi/
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
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