SOLR-10727: SolrIndexSearcher.numDocs empty docSet optimization

This commit is contained in:
David Smiley 2017-05-23 10:51:00 -04:00
parent 85c1319c76
commit 715d8b0ccf
2 changed files with 6 additions and 0 deletions

View File

@ -148,6 +148,9 @@ Optimizations
string fields from the FieldCache, resulting in up to 56% better throughput for those cases. string fields from the FieldCache, resulting in up to 56% better throughput for those cases.
(yonik) (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 Other Changes
---------------------- ----------------------
* SOLR-10236: Removed FieldType.getNumericType(). Use getNumberType() instead. (Tomás Fernández Löbbe) * SOLR-10236: Removed FieldType.getNumericType(). Use getNumberType() instead. (Tomás Fernández Löbbe)

View File

@ -2033,6 +2033,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
* If there is a low-level I/O error. * If there is a low-level I/O error.
*/ */
public int numDocs(Query a, DocSet b) throws IOException { public int numDocs(Query a, DocSet b) throws IOException {
if (b.size() == 0) {
return 0;
}
if (filterCache != null) { if (filterCache != null) {
// Negative query if absolute value different from original // Negative query if absolute value different from original
Query absQ = QueryUtils.getAbs(a); Query absQ = QueryUtils.getAbs(a);