Skip to content

Apache Lucene open-source search software

Remove some useless code in TopScoreDocCollector. (#13955)

Adrien Grand226824241210
diff --git a/lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java b/lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java
index 1524036b20d..025e7937601 100644
--- a/lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java
@@ -254,11 +254,13 @@ public abstract class TopScoreDocCollector extends TopDocsCollector<ScoreDoc> {
}
protected void updateMinCompetitiveScore(Scorable scorer) throws IOException {
- if (hitsThresholdChecker.isThresholdReached()
- && pqTop != null
- && pqTop.score != Float.NEGATIVE_INFINITY) { // -Infinity is the score of sentinels
+ if (hitsThresholdChecker.isThresholdReached()) {
// since we tie-break on doc id and collect in doc id order, we can require
// the next float
+ // pqTop is never null since TopScoreDocCollector fills the priority queue with sentinel
+ // values
+ // if the top element is a sentinel value, its score will be -Infty and the below logic is
+ // still valid
float localMinScore = Math.nextUp(pqTop.score);
if (localMinScore > minCompetitiveScore) {
scorer.setMinCompetitiveScore(localMinScore);