Skip to content

Apache Lucene open-source search software

LUCENE-7238: Explicitly disable the query cache in MemoryIndex.createSearcher.

Adrien Grand2ee8426d5e53
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 7c30ef45ee6..da5a3457958 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -73,6 +73,9 @@ Optimizations
* LUCENE-7235: LRUQueryCache should not take a lock for segments that it will
not cache on anyway. (Adrien Grand)
+* LUCENE-7238: Explicitly disable the query cache in MemoryIndex#createSearcher.
+ (Adrien Grand)
+
Bug Fixes
* LUCENE-7127: Fix corner case bugs in GeoPointDistanceQuery. (Robert Muir)
diff --git a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
index 58a10172329..5b133013ed5 100644
--- a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
+++ b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
@@ -666,6 +666,7 @@ public class MemoryIndex {
MemoryIndexReader reader = new MemoryIndexReader();
IndexSearcher searcher = new IndexSearcher(reader); // ensures no auto-close !!
searcher.setSimilarity(normSimilarity);
+ searcher.setQueryCache(null);
return searcher;
}