From d42ad2cc6c587d4ec014a71dd2524581550e1c2a Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Fri, 6 Dec 2024 10:43:11 +0100 Subject: [PATCH] Remove unused +1 on doc buffer length. (#14043) We no longer take advantatge of it. --- .../lucene/codecs/lucene101/Lucene101PostingsReader.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene101/Lucene101PostingsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene101/Lucene101PostingsReader.java index 004540ad584..1efcdf554dd 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene101/Lucene101PostingsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene101/Lucene101PostingsReader.java @@ -297,7 +297,7 @@ final class BlockPostingsEnum extends ImpactsEnum { private ForDeltaUtil forDeltaUtil; private PForUtil pforUtil; - private final int[] docBuffer = new int[BLOCK_SIZE + 1]; + private final int[] docBuffer = new int[BLOCK_SIZE]; private int doc; // doc we last read @@ -418,10 +418,6 @@ public BlockPostingsEnum(FieldInfo fieldInfo, int flags, boolean needsImpacts) this.needsImpacts = needsImpacts; needsDocsAndFreqsOnly = needsPos == false && needsImpacts == false; - // We set the last element of docBuffer to NO_MORE_DOCS, it helps save conditionals in - // advance() - docBuffer[BLOCK_SIZE] = NO_MORE_DOCS; - if (needsFreq == false) { Arrays.fill(freqBuffer, 1); } @@ -586,7 +582,6 @@ private void refillFullBlock() throws IOException { prevDocID = docBuffer[BLOCK_SIZE - 1]; docBufferUpto = 0; posDocBufferUpto = 0; - assert docBuffer[docBufferSize] == NO_MORE_DOCS; } private void refillRemainder() throws IOException {