You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gu...@apache.org on 2025/07/18 08:58:46 UTC

(lucene) branch main updated: Utilize `docIdRunEnd` on `ReqExclBulkScorer` (#14806)

This is an automated email from the ASF dual-hosted git repository.

guofeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 500efebc67d Utilize `docIdRunEnd` on `ReqExclBulkScorer` (#14806)
500efebc67d is described below

commit 500efebc67d31169cca571a8e73e42a17e45ac8a
Author: Samuel.G <11...@qq.com>
AuthorDate: Fri Jul 18 17:58:40 2025 +0900

    Utilize `docIdRunEnd` on `ReqExclBulkScorer` (#14806)
---
 lucene/CHANGES.txt                                                   | 2 ++
 lucene/core/src/java/org/apache/lucene/search/ReqExclBulkScorer.java | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index f37370b886b..e625456a70c 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -214,6 +214,8 @@ Optimizations
 
 * GITHUB#14896: Vectorize filterCompetitiveHits (Ge Song, Adrien Grand)
 
+* GITHUB#14806: Utilize docIdRunEnd on ReqExclBulkScorer. (Ge Song)
+
 Changes in Runtime Behavior
 ---------------------
 * GITHUB#14823: Decrease TieredMergePolicy's default number of segments per
diff --git a/lucene/core/src/java/org/apache/lucene/search/ReqExclBulkScorer.java b/lucene/core/src/java/org/apache/lucene/search/ReqExclBulkScorer.java
index 7c07ef0386d..0d5c927ea14 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ReqExclBulkScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ReqExclBulkScorer.java
@@ -57,7 +57,10 @@ final class ReqExclBulkScorer extends BulkScorer {
         exclDoc = exclApproximation.advance(upTo);
       }
       if (exclDoc == upTo) {
-        if (exclTwoPhase == null || exclTwoPhase.matches()) {
+        if (exclTwoPhase == null) {
+          // from upTo to docIdRunEnd() are excluded, so we scored up to docIdRunEnd()
+          upTo = exclApproximation.docIDRunEnd();
+        } else if (exclTwoPhase.matches()) {
           // upTo is excluded so we can consider that we scored up to upTo+1
           upTo += 1;
         }