I guess there are many possibilities to implement some control structure to track the references to your searcher / reader. As it is best practice to have one single searcher open you can track the reference to the searcher while one reference is hold by the class you request your searcher from. If you close your searcher you decrement the reference which is hold by the, I will call it "controller", class and create a new searcher. If no reference to the searcher is remaining you close the searcher and it will get garbage collected.
If you use this kind of pattern you might have more than one searcher open for a short time. but if the last "search client" has decremented the reference the searcher will be closed. You don't have to care whether the searcher is closed or not, you won't get a reference to a closed searcher instance. Solr and GData Server uses this kind of reference tracking for this purpose. have a look at http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/utils/ReferenceCounter.java?view=markup best regards Simon On 9/26/06, Frank Kunemann <[EMAIL PROTECTED]> wrote:
Hi all, after I delete some entries from the index, I close the IndexSearcher to ensure that the changes are done. But after this I couldn't figure out a way to tell if the searcher is closed or not. Any ideas? Regards Frank --------------------------------------------------------------------- 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]