Apache Lucene open-source search software
LUCENE-8078: The query cache should not cache instances of MatchNoDocsQuery
Adrien Grandbdaf1baa8081
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 10a6351ad66..c86156607ce 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -127,6 +127,9 @@ Bug Fixes* LUCENE-8034: Use subtraction instead of addition to sidestep intoverflow in SpanNotQuery. (Hari Menon via Mike McCandless)+* LUCENE-8078: The query cache should not cache instances of+ MatchNoDocsQuery. (Jon Harper via Adrien Grand)+Optimizations* LUCENE-8018: Smaller FieldInfos memory footprint by not retaining unnecessarydiff --git a/lucene/core/src/java/org/apache/lucene/search/UsageTrackingQueryCachingPolicy.java b/lucene/core/src/java/org/apache/lucene/search/UsageTrackingQueryCachingPolicy.javaindex 1bbed5c05b0..c16d7f24914 100644--- a/lucene/core/src/java/org/apache/lucene/search/UsageTrackingQueryCachingPolicy.java+++ b/lucene/core/src/java/org/apache/lucene/search/UsageTrackingQueryCachingPolicy.java@@ -68,7 +68,7 @@ public class UsageTrackingQueryCachingPolicy implements QueryCachingPolicy {// For the below queries, it's cheap to notice they cannot match any docs so// we do not bother caching them.if (query instanceof MatchNoDocsQuery) {- return false;+ return true;}if (query instanceof BooleanQuery) {