lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1701967 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/CHANGES.txt lucene/core/ lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
Date Wed, 09 Sep 2015 09:53:53 GMT
Author: jpountz
Date: Wed Sep  9 09:53:53 2015
New Revision: 1701967

URL: http://svn.apache.org/r1701967
Log:
LUCENE-6784: IndexSearcher's query caching is enabled by default.

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/lucene/core/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java

Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1701967&r1=1701966&r2=1701967&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Wed Sep  9 09:53:53 2015
@@ -131,6 +131,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

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java?rev=1701967&r1=1701966&r2=1701967&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
Wed Sep  9 09:53:53 2015
@@ -126,9 +126,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!
   



Mime
View raw message