romseygeek commented on code in PR #17021:
URL: https://github.com/apache/lucene/pull/17021#discussion_r4583965623


##########
lucene/core/src/java/org/apache/lucene/search/DenseConjunctionBulkScorer.java:
##########
@@ -286,9 +286,8 @@ private void scoreWindowUsingBitSet(
     int windowSize = windowMax - windowBase;
     int threshold = windowSize / DENSITY_THRESHOLD_INVERSE;
     int upTo = 1; // the leading clause at index 0 is already applied
-    for (int cardinality = windowMatches.cardinality();
-        upTo < iterators.size() && cardinality >= threshold;
-        upTo++, cardinality = windowMatches.cardinality()) {
+    // Only compute the cardinality of the window if there are clauses left to 
apply.
+    for (; upTo < iterators.size() && windowMatches.cardinality() >= 
threshold; upTo++) {

Review Comment:
   Let's move `int upTo = 1` into the `for` loop to make it more idiomatic Java.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to