diff --git a/lucene/core/src/java/org/apache/lucene/codecs/SortedDocValuesConsumer.java b/lucene/core/src/java/org/apache/lucene/codecs/SortedDocValuesConsumer.java index 41d66cf1300..0e7e3f8e02a 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/SortedDocValuesConsumer.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/SortedDocValuesConsumer.java @@ -139,7 +139,6 @@ public abstract class SortedDocValuesConsumer { } BytesRef lastTerm = null; - boolean first = true; int ord = 0; while (q.size() != 0) { SegmentState top = q.top(); @@ -148,10 +147,10 @@ public abstract class SortedDocValuesConsumer { // nocommit we could spill this to disk instead of // RAM, and replay on finish... mergedTerms.add(lastTerm); - if (lastTerm == null) { + ord++; + if (fixedLength == -2) { fixedLength = lastTerm.length; } else { - ord++; if (lastTerm.length != fixedLength) { fixedLength = -1; }