From afc990cd2b43cb4731744ca867fb13173fd76dc8 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Fri, 13 Oct 2023 10:42:34 +0200 Subject: [PATCH] Fix lazy decoding of frequencies in `BlockImpactsDocsEnum`. (#12668) The code was written as if frequencies should be lazily decoding, except that when refilling buffers freqs were getting eagerly decoded instead of lazily. --- lucene/CHANGES.txt | 3 +++ .../apache/lucene/codecs/lucene90/Lucene90PostingsReader.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index b9a3a35da05..5ed0623940b 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -183,6 +183,9 @@ Optimizations * GITHUB#12631: Write MSB VLong for better outputs sharing in block tree index, decreasing ~14% size of .tip file. (Guo Feng) +* GITHUB#12668: ImpactsEnums now decode frequencies lazily like PostingsEnums. + (Adrien Grand) + Changes in runtime behavior --------------------- diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java index e2223598033..0f60ee29e49 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90PostingsReader.java @@ -1143,7 +1143,7 @@ public final class Lucene90PostingsReader extends PostingsReaderBase { if (left >= BLOCK_SIZE) { pforUtil.decodeAndPrefixSum(docIn, accum, docBuffer); if (indexHasFreqs) { - pforUtil.decode(docIn, freqBuffer); + isFreqsRead = false; } blockUpto += BLOCK_SIZE; } else {