You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2017/05/23 14:51:10 UTC

lucene-solr:master: SOLR-10727: SolrIndexSearcher.numDocs empty docSet optimization

Repository: lucene-solr
Updated Branches:
  refs/heads/master 85c1319c7 -> 715d8b0cc


SOLR-10727: SolrIndexSearcher.numDocs empty docSet optimization


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/715d8b0c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/715d8b0c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/715d8b0c

Branch: refs/heads/master
Commit: 715d8b0ccf42d30661a7964c33bd27c9fec3d18e
Parents: 85c1319
Author: David Smiley <ds...@apache.org>
Authored: Tue May 23 10:51:00 2017 -0400
Committer: David Smiley <ds...@apache.org>
Committed: Tue May 23 10:51:00 2017 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                                 | 3 +++
 solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java | 3 +++
 2 files changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/715d8b0c/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 799df74..7a604f4 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -148,6 +148,9 @@ Optimizations
   string fields from the FieldCache, resulting in up to 56% better throughput for those cases.
   (yonik)
 
+* SOLR-10727: Avoid polluting the filter cache for certain types of faceting (typically ranges) when
+  the base docset is empty. (David Smiley)
+
 Other Changes
 ----------------------
 * SOLR-10236: Removed FieldType.getNumericType(). Use getNumberType() instead. (Tomás Fernández Löbbe)

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/715d8b0c/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
index 9d63aad..599fd24 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -2033,6 +2033,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
    *           If there is a low-level I/O error.
    */
   public int numDocs(Query a, DocSet b) throws IOException {
+    if (b.size() == 0) {
+      return 0;
+    }
     if (filterCache != null) {
       // Negative query if absolute value different from original
       Query absQ = QueryUtils.getAbs(a);