Arggggg. I did no foresee this one either. I thought they used SoftReferences
OK so let me detail some solutions:
- go back to a specific implementation of CachingWrapperFilter that read the underlying readers and cache by the first element: this was a workaround proposed here
http://forum.hibernate.org/viewtopic.php?p=2369054#2369054
The problem with this solution is that caching by the first element is wrong, it should be cached by "all elements" in a way. This is probably possible by storing an HashMap as a value containing all readers having their first elements as key.
- use the Lucene RemoteCachingWrapperFilter: this cache does not use WeakReferences but rather a hard limit and a Thread pool cleaning the map. I am not a big fan of it especially since the FilterManager is statically defined and as any hard limit cache it is subject to OOME
But this should solve your problem in the mean time
- introduce a @FullTextFilterDef.enableCachingWrapperFilter
whose value could be AUTOMATIC, TRUE, FALSE
HSearch could then use it's own implementation of CachingWrapperFilter
AUTOMATIC would use a wrapper when cache=true is used, and not use one when cache=false
This solution is my favorite so far, I think I will introduce it in 3.1
What do you think?