diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index fb9e7665a9e..53c5c03ade9 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -30,6 +30,10 @@ Bug Fixes * GITHUB#14075: Remove duplicate and add missing entry on brazilian portuguese stopwords list. (Arthur Caccavo) +Changes in Runtime Behavior +--------------------- +* GITHUB#14187: The query cache is now disabled by default. (Adrien Grand) + Other --------------------- (No changes) diff --git a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java index e3074a96d88..18fc5266f99 100644 --- a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java +++ b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java @@ -77,7 +77,8 @@ public class IndexSearcher { static int maxClauseCount = 1024; - private static QueryCache DEFAULT_QUERY_CACHE; + // Caching is disabled by default. + private static QueryCache DEFAULT_QUERY_CACHE = null; private static QueryCachingPolicy DEFAULT_CACHING_POLICY = new UsageTrackingQueryCachingPolicy(); private QueryTimeout queryTimeout = null; // partialResult may be set on one of the threads of the executor. It may be correct to not make @@ -86,13 +87,6 @@ public class IndexSearcher { // shouldn't hurt either. private volatile boolean partialResult = false; - static { - final int maxCachedQueries = 1000; - // min of 32MB or 5% of the heap size - final long maxRamBytesUsed = Math.min(1L << 25, Runtime.getRuntime().maxMemory() / 20); - DEFAULT_QUERY_CACHE = new LRUQueryCache(maxCachedQueries, maxRamBytesUsed); - } - /** * By default, we count hits accurately up to 1000. This makes sure that we don't spend most time * on computing hit counts