Apache Lucene open-source search software
SOLR-10727: SolrIndexSearcher.numDocs empty docSet optimization
David Smiley715d8b0ccf42
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 799df7459ce..7a604f4f45a 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -148,6 +148,9 @@ Optimizationsstring 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)diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.javaindex 9d63aadeef3..599fd2461bc 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 originalQuery absQ = QueryUtils.getAbs(a);