diff --git a/lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.java b/lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.java index 36e64f6df89..cff3f846162 100644 --- a/lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.java +++ b/lucene/core/src/java/org/apache/lucene/search/comparators/TermOrdValComparator.java @@ -403,7 +403,7 @@ public class TermOrdValComparator extends FieldComparator { minOrd = -1; } - if (bottomOrd == Integer.MAX_VALUE) { + if (bottomOrd == missingOrd) { // The queue still contains missing values. if (singleSort) { // If there is no tie breaker, we can start ignoring missing values from now on. @@ -421,7 +421,7 @@ public class TermOrdValComparator extends FieldComparator { } else { - if (bottomOrd == -1) { + if (bottomOrd == missingOrd) { // The queue still contains missing values. if (singleSort) { // If there is no tie breaker, we can start ignoring missing values from now on.