LUCENE-6784: IndexSearcher's query caching is enabled by default.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1701964 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2015-09-09 09:48:04 +00:00
parent 41daf71ed4
commit db6083e255
2 changed files with 10 additions and 2 deletions

View File

@ -181,6 +181,9 @@ Changes in Runtime Behavior
removes the collector that threw this exception from the list of sub
collectors to collect. (Adrien Grand)
* LUCENE-6784: IndexSearcher's query caching is enabled by default. Run
indexSearcher.setQueryCache(null) to disable. (Adrien Grand)
======================= Lucene 5.3.0 =======================
New Features

View File

@ -125,9 +125,14 @@ public class IndexSearcher {
};
// disabled by default
private static QueryCache DEFAULT_QUERY_CACHE = null;
private static QueryCache DEFAULT_QUERY_CACHE;
private static QueryCachingPolicy DEFAULT_CACHING_POLICY = new UsageTrackingQueryCachingPolicy();
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);
}
final IndexReader reader; // package private for testing!