OK, I won't do any caching, Lucene will cache if applicable: https://issues.apache.org/jira/browse/LUCENE-6855
However, I think the usage in the Javadoc ( https://lucene.apache.org/core/5_5_0/core/org/apache/lucene/search/LRUQueryCache.html) should be fixed anyway. On Thu, Feb 25, 2016 at 7:07 PM, Otmar Caduff <ocad...@gmail.com> wrote: > Hi > > > > Just switched from Lucene 5.1 to Lucene 5.5 and noticed that > org.apache.lucene.search.CachingWrapperQuery has been deprecated. > > > > Up until now I used that class to solve the following problem: I have a > query covering multiple fields. In the end, I have to give feedback on > which fields matched. Once the original query was run, I re-executed the > query, but restricting to the single fields involved, so as to find out > which ones matched. I achieved this having the original query wrapped in a > CachingWrapperQuery. > > > According to the Javadoc ( > https://lucene.apache.org/core/5_5_0/core/org/apache/lucene/search/CachingWrapperQuery.html), > I should now switch to something like LRUQueryCache. > > The typical usage mentioned in the Javadoc ( > https://lucene.apache.org/core/5_5_0/core/org/apache/lucene/search/LRUQueryCache.html) > didn’t help me, since as opposed to the use provided in the Javadoc, there > is no method “Query doCache(Query query, QueryCachingPolicy policy)”, but > “Weight doCache(Weight weight, QueryCachingPolicy policy)” instead. > > > However, since the LRUQueryCache is marked as experimental, I’m not sure > if I’m still on a good track. Should I solve my problem differently? > > > Any help would be appreciated! > > > Otmar >