From 7f0f65d535ad9db33ebe13c495b739d5d17c5942 Mon Sep 17 00:00:00 2001 From: Luca Cavanna Date: Mon, 16 Sep 2024 11:15:26 +0200 Subject: [PATCH] Deprecate BulkScorer#score(LeafReaderContext, Bits) We have removed BulkScorer#score(LeafReaderContext, Bits) in main in favour of BulkScorer#score(LeafCollector collector, Bits acceptDocs, int min, int max) as part of #13542. This commit deprecates the method in 9.x. Internal usages of it are left untouched as there may be subclasses that override it, which we don't want to break in a minor release. --- lucene/CHANGES.txt | 5 +++++ .../core/src/java/org/apache/lucene/search/BulkScorer.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index dac89dc7dc88..3316cec5814b 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -30,6 +30,11 @@ API Changes * GITHUB#13735: Add CollectorManager#forSequentialExecution to make CollectorManager creation more convenient for users of the deprecated IndexSearcher#search(Query, Collector). (Greg Miller) +* GITHUB#?????: Deprecate BulkScorer#score(LeafCollector collector, Bits acceptDocs) in favour of + BulkScorer#score(LeafCollector collector, Bits acceptDocs, int min, int max). The method will be removed in the next + major version. Replace usages with the latter, providing 0 as min and DocIdSetIterator.NO_MORE_DOCS as max in case + the entire segment should be scored. (Luca Cavanna) + New Features --------------------- diff --git a/lucene/core/src/java/org/apache/lucene/search/BulkScorer.java b/lucene/core/src/java/org/apache/lucene/search/BulkScorer.java index fb7805ac6ced..3eece780fb53 100644 --- a/lucene/core/src/java/org/apache/lucene/search/BulkScorer.java +++ b/lucene/core/src/java/org/apache/lucene/search/BulkScorer.java @@ -33,7 +33,11 @@ public abstract class BulkScorer { * @param collector The collector to which all matching documents are passed. * @param acceptDocs {@link Bits} that represents the allowed documents to match, or {@code null} * if they are all allowed to match. + * @deprecated in favour of {@link #score(LeafCollector, Bits, int, int)}. Callers should instead + * call the method variant that takes min and max as arguments. Subclasses that override it + * should instead override its replacement. */ + @Deprecated public void score(LeafCollector collector, Bits acceptDocs) throws IOException { final int next = score(collector, acceptDocs, 0, DocIdSetIterator.NO_MORE_DOCS); assert next == DocIdSetIterator.NO_MORE_DOCS;