Skip to content

Apache Lucene open-source search software

LUCENE-2839: Scorer#score(Collector,int,int) is now public because it is called from other classes and part of public API

Uwe Schindlera04ade4448a0
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index fdd2e6c78d1..7ca14de759b 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -131,6 +131,9 @@ Changes in backwards compatibility policy
* LUCENE-2837: Changed Weight#scorer, Weight#explain & Filter#getDocIdSet to
operate on a ReaderContext instead of directly on IndexReader to enable
searches to be aware of IndexSearcher's context. (Simon Willnauer)
+
+* LUCENE-2839: Scorer#score(Collector,int,int) is now public because it is
+ called from other classes and part of public API. (Uwe Schindler)
Changes in Runtime Behavior
diff --git a/lucene/src/java/org/apache/lucene/search/BooleanScorer.java b/lucene/src/java/org/apache/lucene/search/BooleanScorer.java
index a4db5bdb4de..6374e89f98b 100644
--- a/lucene/src/java/org/apache/lucene/search/BooleanScorer.java
+++ b/lucene/src/java/org/apache/lucene/search/BooleanScorer.java
@@ -229,7 +229,7 @@ final class BooleanScorer extends Scorer {
// firstDocID is ignored since nextDoc() initializes 'current'
@Override
- protected boolean score(Collector collector, int max, int firstDocID) throws IOException {
+ public boolean score(Collector collector, int max, int firstDocID) throws IOException {
boolean more;
Bucket tmp;
BucketScorer bs = new BucketScorer();
diff --git a/lucene/src/java/org/apache/lucene/search/BooleanScorer2.java b/lucene/src/java/org/apache/lucene/search/BooleanScorer2.java
index 0d47da6ce58..d1a7a6d38b7 100644
--- a/lucene/src/java/org/apache/lucene/search/BooleanScorer2.java
+++ b/lucene/src/java/org/apache/lucene/search/BooleanScorer2.java
@@ -280,7 +280,7 @@ class BooleanScorer2 extends Scorer {
}
@Override
- protected boolean score(Collector collector, int max, int firstDocID) throws IOException {
+ public boolean score(Collector collector, int max, int firstDocID) throws IOException {
doc = firstDocID;
collector.setScorer(this);
while (doc < max) {
diff --git a/lucene/src/java/org/apache/lucene/search/ConstantScoreQuery.java b/lucene/src/java/org/apache/lucene/search/ConstantScoreQuery.java
index 6af8ed5305c..10090e98ee9 100644
--- a/lucene/src/java/org/apache/lucene/search/ConstantScoreQuery.java
+++ b/lucene/src/java/org/apache/lucene/search/ConstantScoreQuery.java
@@ -244,10 +244,8 @@ public class ConstantScoreQuery extends Query {
}
// this optimization allows out of order scoring as top scorer,
- // TODO: theoretically this method should not be called because its protected and
- // this class does not use it, it should be public in Scorer!
@Override
- protected boolean score(Collector collector, int max, int firstDocID) throws IOException {
+ public boolean score(Collector collector, int max, int firstDocID) throws IOException {
if (docIdSetIterator instanceof Scorer) {
return ((Scorer) docIdSetIterator).score(wrapCollector(collector), max, firstDocID);
} else {
diff --git a/lucene/src/java/org/apache/lucene/search/DisjunctionSumScorer.java b/lucene/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
index 7e5016d902b..5ec3514e95b 100644
--- a/lucene/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
+++ b/lucene/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
@@ -123,7 +123,7 @@ class DisjunctionSumScorer extends Scorer {
* @return true if more matching documents may remain.
*/
@Override
- protected boolean score(Collector collector, int max, int firstDocID) throws IOException {
+ public boolean score(Collector collector, int max, int firstDocID) throws IOException {
// firstDocID is ignored since nextDoc() sets 'currentDoc'
collector.setScorer(this);
while (currentDoc < max) {
diff --git a/lucene/src/java/org/apache/lucene/search/ScoreCachingWrappingScorer.java b/lucene/src/java/org/apache/lucene/search/ScoreCachingWrappingScorer.java
index 09a0bcd817d..b35e452252f 100644
--- a/lucene/src/java/org/apache/lucene/search/ScoreCachingWrappingScorer.java
+++ b/lucene/src/java/org/apache/lucene/search/ScoreCachingWrappingScorer.java
@@ -43,7 +43,7 @@ public class ScoreCachingWrappingScorer extends Scorer {
}
@Override
- protected boolean score(Collector collector, int max, int firstDocID) throws IOException {
+ public boolean score(Collector collector, int max, int firstDocID) throws IOException {
return scorer.score(collector, max, firstDocID);
}
diff --git a/lucene/src/java/org/apache/lucene/search/Scorer.java b/lucene/src/java/org/apache/lucene/search/Scorer.java
index 84e51431e88..907cdf3aa8a 100644
--- a/lucene/src/java/org/apache/lucene/search/Scorer.java
+++ b/lucene/src/java/org/apache/lucene/search/Scorer.java
@@ -90,7 +90,7 @@ public abstract class Scorer extends DocIdSetIterator {
* this method.
* @return true if more matching documents may remain.
*/
- protected boolean score(Collector collector, int max, int firstDocID) throws IOException {
+ public boolean score(Collector collector, int max, int firstDocID) throws IOException {
collector.setScorer(this);
int doc = firstDocID;
while (doc < max) {
diff --git a/lucene/src/java/org/apache/lucene/search/TermScorer.java b/lucene/src/java/org/apache/lucene/search/TermScorer.java
index 48ddd3e05cd..cffea443afc 100644
--- a/lucene/src/java/org/apache/lucene/search/TermScorer.java
+++ b/lucene/src/java/org/apache/lucene/search/TermScorer.java
@@ -77,7 +77,7 @@ final class TermScorer extends Scorer {
// firstDocID is ignored since nextDoc() sets 'doc'
@Override
- protected boolean score(Collector c, int end, int firstDocID) throws IOException {
+ public boolean score(Collector c, int end, int firstDocID) throws IOException {
c.setScorer(this);
while (doc < end) { // for docs in window
c.collect(doc); // collect score
diff --git a/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java b/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
index 43cd8370e5a..f0488f5b7d4 100644
--- a/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
+++ b/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
@@ -215,7 +215,7 @@ final class JustCompileSearch {
}
@Override
- protected boolean score(Collector collector, int max, int firstDocID)
+ public boolean score(Collector collector, int max, int firstDocID)
throws IOException {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}