Hi,

I'm looking at lucene-core UsageTrackingQueryCachingPolicy.java (caching
policy for the LRUCache), one line of code looks dubious in the
shouldNeverCache method

The comment says "For the below queries, it's cheap to notice they cannot
match any docs so     we do not bother caching them. "  but then returns
false to shouldnevercache for MatchNoDocsQuery

Note that empty BooleanQuery and empty DisjunctionMaxQuery return true and
hence are never cached

Here's a github link to the line in question for easy and quick access.

https://github.com/apache/lucene-solr/blob/1d2787464f4709f4960716dd3314c7123324b15b/lucene/core/src/java/org/apache/lucene/search/UsageTrackingQueryCachingPolicy.java#L71


Regards,
Jon

Reply via email to