magibney commented on a change in pull request #2123:
URL: https://github.com/apache/lucene-solr/pull/2123#discussion_r537520652



##########
File path: solr/core/src/java/org/apache/solr/request/SimpleFacets.java
##########
@@ -903,7 +910,7 @@ public void execute(Runnable r) {
 
   private int numDocs(String term, final SchemaField sf, final FieldType ft, 
final DocSet baseDocset) {
     try {
-      return searcher.numDocs(ft.getFieldQuery(null, sf, term), baseDocset);
+      return baseDocset.size() == 0? 0: 
searcher.numDocs(ft.getFieldQuery(null, sf, term), baseDocset);

Review comment:
       Line 903 (immediately above) is the only caller of this private method. 
Would it make sense to do the check in only one of these places? Maybe prefer 
the higher-level (line 903) check, where the check could also be used to bypass 
`termCountEntries.sorted(...)`? Could optionally leave `assert 
baseDocset.size() > 0` here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to