Skip to content

Apache Lucene open-source search software

Align comments with upgraded postings format (#14368)

Amos Birde7f9bc837e41
diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene912/Lucene912PostingsReader.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene912/Lucene912PostingsReader.java
index a51c848c4cc..86111d787bc 100644
--- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene912/Lucene912PostingsReader.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene912/Lucene912PostingsReader.java
@@ -1770,9 +1770,8 @@ public final class Lucene912PostingsReader extends PostingsReaderBase {
if (docIn.getFilePointer() != state.docStartFP) {
// Don't prefetch if the input is already positioned at the right offset, which suggests that
// the caller is streaming the entire inverted index (e.g. for merging), let the read-ahead
- // logic do its work instead. Note that this heuristic doesn't work for terms that have skip
- // data, since skip data is stored after the last term, but handling all terms that have <128
- // docs is a good start already.
+ // logic do its work instead. Note that this heuristic also handles terms with skip data
+ // starting in version 912, where skip data was directly inlined into postings lists.
docIn.prefetch(state.docStartFP, 1);
}
// Note: we don't prefetch positions or offsets, which are less likely to be needed.
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 b73e6316a7d..930ac0251f2 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
@@ -1358,9 +1358,8 @@ public final class Lucene101PostingsReader extends PostingsReaderBase {
if (docIn.getFilePointer() != state.docStartFP) {
// Don't prefetch if the input is already positioned at the right offset, which suggests that
// the caller is streaming the entire inverted index (e.g. for merging), let the read-ahead
- // logic do its work instead. Note that this heuristic doesn't work for terms that have skip
- // data, since skip data is stored after the last term, but handling all terms that have <128
- // docs is a good start already.
+ // logic do its work instead. Note that this heuristic also handles terms with skip data
+ // starting in version 912, where skip data was directly inlined into postings lists.
docIn.prefetch(state.docStartFP, 1);
}
// Note: we don't prefetch positions or offsets, which are less likely to be needed.