lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dror Matalon <>
Subject Re: best way of reusing IndexSearcher objects
Date Thu, 18 Dec 2003 19:27:10 GMT
> Some time ago (Nov 5) Otis suggested to use one IndexSearcher instance for
> search and recreate this instance when the index changed:
> > Use a single instance of IndexSearcher.
> > When you detect that the index has changed, through that instance (see
> > javadoc for the exact method name, I don't recall its exact name now),
> > discard that instance, and make a new one.

Isn't this easier said than done? In a web environment, you have hits
coming in and searching continuously. 

There are two issues:
1. Having new searches start using the new index only when it's ready,
not in a "half baked" state, which means that you have to synchronize
the switch from the old index to the new one.
2. It's not trivial to figure out when it's safe to discard the old
index; all existing searches are done with it.

To make things more complicated, the Hits object is dependent on your
IndexSearcher object, so if you have Hits objects in use you probably
can't  close your IndexSearcher.

Is this a correct analysis or is there an obvious strategy to work
around this issue?



Dror Matalon
Zapatec Inc 
1700 MLK Way
Berkeley, CA 94709

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

View raw message