Skip to content

Commit b9288ae

Browse files
Fix encoding selection logic in Lucene104PostingsWriter (#15174)
1 parent 79a98b4 commit b9288ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lucene/core/src/java/org/apache/lucene/codecs/lucene104/Lucene104PostingsWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ private void flushDocBlock(boolean finishTerm) throws IOException {
438438
int numBitsNextBitsPerValue = Math.min(Integer.SIZE, bitsPerValue + 1) * BLOCK_SIZE;
439439
if (docRange == BLOCK_SIZE) {
440440
level0Output.writeByte((byte) 0);
441-
} else if (numBitsNextBitsPerValue <= docRange) {
441+
} else if (numBitsNextBitsPerValue <= (numBitSetLongs * Long.SIZE)) {
442442
level0Output.writeByte((byte) bitsPerValue);
443443
forUtil.encode(docDeltaBuffer, bitsPerValue, level0Output);
444444
} else {

0 commit comments

Comments
 (0)