lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Steiger <>
Subject Re: Best Practices for indexing in Web application
Date Tue, 02 Mar 2004 22:10:04 GMT
Kelvin Tan wrote:

> On Mon, 01 Mar 2004 12:24:26 +0100, Michael Steiger said:
>>1. Concurrency of IndexWriter and IndexReader
>>It seems that it is not allowed to open an IndexWriter and an
>>IndexReader at the same time. But if one user is changing records in the
>>database (and therefore changing documents in the Lucene index) and
>>another user is querying the index, I would need to open them both.
> Not necessarily so. Shouldn't you be using an IndexSearcher to query the index 
> instead of an IndexReader? IndexReader should be used primarily for deleting and 
> low-level document retrieval via Terms.

I am using an IndexSearcher for querying the index but for deletions I 
need to use the IndexReader. I now know that I can have Readers and a 
Writer open concurrently but IndexReader.delete can only be used if no 
Writer is open.

>>2. Optimizing the index
>>This is maybe related to my first issue.
>>I assume that while optimizing the index no queries are allowed. How
>>often should the index be optimized?
> Again, IndexSearcher has no problem with the index being modified (via 
> optimizing, or otherwise) whilst searching. However, you'll need to have some 
> way of refreshing your IndexSearcher when this happens, otherwise the 
> IndexSearcher  would be obsolete.

I want to open the IndexSearcher only while searching and close it 


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

View raw message