zhaih commented on code in PR #950:
URL: https://github.com/apache/lucene/pull/950#discussion_r894079898


##########
lucene/core/src/java/org/apache/lucene/search/BooleanWeight.java:
##########
@@ -344,6 +344,45 @@ public BulkScorer bulkScorer(LeafReaderContext context) 
throws IOException {
     }
   }
 
+  @Override
+  public int count(LeafReaderContext context) throws IOException {
+    // Implement counting for pure conjunctions in the case when one clause 
doesn't match any docs,
+    // or all clauses but one match all docs.
+    if (weightedClauses.isEmpty()) {
+      return 0;
+    }
+    for (WeightedBooleanClause weightedClause : weightedClauses) {
+      switch (weightedClause.clause.getOccur()) {
+        case FILTER:
+        case MUST:
+          break;
+        case MUST_NOT:

Review Comment:
   Why can't we include the MUST_NOT clause here? Isn't the count effectively 
`maxDoc - clause.count()`?



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

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