I have been struggling with the same issue. What I have done so far is to create a singleton for each index and then synchronize all add and remove calls. When the remove is called it checks to see if the index is locked, if not it sets a Boolean to prevent an IndexWriter from being opened. This seems to be working but I am still testing.
Regards, James -----Original Message----- From: Dror Matalon [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 2:27 PM To: Lucene Users List Subject: Re: best way of reusing IndexSearcher objects > 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? Regards, Dror -- Dror Matalon Zapatec Inc 1700 MLK Way Berkeley, CA 94709 http://www.fastbuzz.com http://www.zapatec.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]