iprithv commented on code in PR #16220:
URL: https://github.com/apache/lucene/pull/16220#discussion_r3659488722


##########
lucene/core/src/java/org/apache/lucene/search/WANDScorer.java:
##########
@@ -566,17 +566,19 @@ public float score() throws IOException {
 
   @Override
   public int advanceShallow(int target) throws IOException {
-    // Propagate to improve score bounds
+    // Propagate to sub-scorers. Scorers past target constrain the boundary to 
docID - 1.
+    int newUpTo = DocIdSetIterator.NO_MORE_DOCS;
     for (Scorer scorer : allScorers) {
-      if (scorer.docID() < target) {
-        scorer.advanceShallow(target);
+      // Use <= instead of < so we still propagate and use the block boundary 
when already at
+      // target.
+      if (scorer.docID() <= target) {
+        newUpTo = Math.min(newUpTo, scorer.advanceShallow(target));
+      } else if (scorer.docID() != DocIdSetIterator.NO_MORE_DOCS) {
+        newUpTo = Math.min(newUpTo, scorer.docID() - 1);
       }
     }
-    if (target <= upTo) {
-      return upTo;
-    }
-    // TODO: implement
-    return DocIdSetIterator.NO_MORE_DOCS;
+    // If within the current block, prefer the tighter freshly-computed 
boundary.
+    return target <= upTo ? Math.min(upTo, newUpTo) : newUpTo;

Review Comment:
   yeah we don't need upTo and newUpTo is already tight boundary...we propagate 
advanceShallow(target) to all sub-scorers at or before target, and use docID - 
1 for those already past it.. getMaxScore(upTo) implementation queries each 
sub-scorer directly with the provided upTo parameter anyway, so clamping to the 
internal block boundary only shrinks the window..changed it. thanks!



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