lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Brown <yogieric....@gmail.com>
Subject Cached Hits / closing IndexSearcher after add/delete w/IndexModifier
Date Wed, 29 Nov 2006 10:40:38 GMT
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message