I'm using lucene as a backend for my webservices that provide add, remove and search operations. When I add or remove documents via IndexModifier, I believe I'm supposed to close the IndexSearcher I use for query requests. However, I cache Hits and I believe the javadocs indicate closing an IndexSearcher will invalidate the cached Hits such that trying to retrieve a doc may throw an exception. So my solution is to wrap the IndexSearcher in another class with a finalizer that closes the IndexSearcher when all the Hits dereference it. My question is whether my cached hits have a solid reference to IndexSearcher such that I can rely on it being closed only after I expire the Hits from the cache?

Also, should I keep one IndexModifier open for the life of my service/ application or should I open and close it when I get new requests to add or remove documents? (I don't really have control over batching unfortunately -- though I've certainly pointed it out.)

Thanks,
Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to