lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aad Nales" <>
Subject RE: using optimize and addDocument concurrently.
Date Tue, 19 Oct 2004 15:37:56 GMT

The behavior that you descibe is as expected. I have tackled a similar
problem to yours by creating a proxy object that acts as a gatekeeper to
all IndexReader, IndexSearcher and IndexWriter operations. With fully
synchronized access to all methods of the proxy you will not run into
any problems. Everytime I need to perform something with the writer, I
close the searcher etc.

As to regular optimization I tend to reindex now and again with a
completely seperate writer and replace the index by moving it to the new
location. This BTW has also become a method in my proxy object.

Hope this helps,


My basic question is whether it is possible to continue to add documents
to an index in one Thread while running a long running optimization of
the index (approx 30 mins) in another thread.  I'm using Lucene version
1.4.2.  The concurrency matrix at shows that if you use the
same IndexWriter object you can do concurrent writes and optimization.
When I try it in my program the addDocuments wait until the optimization
has finished, so in this respect it is Thread safe, but the operations
cannot be performed at the same time.  Our problem is that the index
needs to be continually kept up to date with new news articles, but also
needs to be regularly optimized to keep it fast.  If I cannot update and
optimize one index at the same time the best way I can see of doing this
is maintaining multiple identical indexes and offlining, optimizing,
letting them catch up-to-date and re-onlining them.  Does that sounds
best to you?

Thanks a lot in advance


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

View raw message