Note: it might not be possible, because we expose FilterCachingStrategy as an API, and this API may not be appropriate for org.apache.lucene.search.QueryCache.
It seems to be the case.
- QueryCache manipulates objects of type Weight
FilterCachingStrategy, on the other hand, manipulates objects of type Query. We can transform a Weight to a Query, but it would be a lossy transformation, so the transformation back to a Weight (when fetching from the cache) would prove difficult at best.
- QueryCache is supposed to take into account a QueryCachingPolicy, which makes the decision as to whether an object should be cached or not
FilterCachingStrategy, on the other hand, implements both the cache and the policy. Even if we wrapped a QueryCache around the FilterCachingStrategy, we'd have trouble enforcing the policy strictly: some objects supposed to be cached probably wouldn't be.
On top of that, some users may already be making use of the QueryCache (the user who reported
HSEARCH-2691 Closed , for one). If we overrode the query cache to wire it to the FilterCachingStrategy, we'd probably break something in their application... For those reasons, I'm postponing this to 6.0. |