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


##########
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:
+        case SHOULD:

Review Comment:
   If `weightedClauses.size() == 1`, and this clause's occur is `SHOULD`, we 
could also leverage `Weight#count`, should we need to specialize this case?



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