Apache Lucene open-source search software
LUCENE-8906: Lucene50PostingsFormat.IntBlockTermState becomes public
Bruno Roustant52b5ec806886
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex b4767a20b02..ef85717eca8 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -78,6 +78,9 @@ Improvements* LUCENE-8916: GraphTokenStreamFiniteStrings preserves all Token attributesthrough its finite strings TokenStreams (Alan Woodward)+* LUCENE-8906: Expose Lucene50PostingsFormat.IntBlockTermState as public so that other postings formats can re-use it.+ (Bruno Roustant)+Optimizations* LUCENE-8922: DisjunctionMaxQuery more efficiently leverages impacts to skipdiff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsFormat.javaindex 615909e9dd0..960615a5cd7 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsFormat.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsFormat.java@@ -452,16 +452,36 @@ public final class Lucene50PostingsFormat extends PostingsFormat {}}}-- final static class IntBlockTermState extends BlockTermState {- long docStartFP = 0;- long posStartFP = 0;- long payStartFP = 0;- long skipOffset = -1;- long lastPosBlockOffset = -1;- // docid when there is a single pulsed posting, otherwise -1- // freq is always implicitly totalTermFreq in this case.- int singletonDocID = -1;++ /**+ * Holds all state required for {@link Lucene50PostingsReader} to produce a+ * {@link org.apache.lucene.index.PostingsEnum} without re-seeking the terms dict.+ *+ * @lucene.internal+ */+ public static final class IntBlockTermState extends BlockTermState {+ /** file pointer to the start of the doc ids enumeration, in {@link #DOC_EXTENSION} file */+ public long docStartFP;+ /** file pointer to the start of the positions enumeration, in {@link #POS_EXTENSION} file */+ public long posStartFP;+ /** file pointer to the start of the payloads enumeration, in {@link #PAY_EXTENSION} file */+ public long payStartFP;+ /** file offset for the start of the skip list, relative to docStartFP, if there are more+ * than {@link #BLOCK_SIZE} docs; otherwise -1 */+ public long skipOffset;+ /** file offset for the last position in the last block, if there are more than+ * {@link #BLOCK_SIZE} positions; otherwise -1 */+ public long lastPosBlockOffset;+ /** docid when there is a single pulsed posting, otherwise -1.+ * freq is always implicitly totalTermFreq in this case. */+ public int singletonDocID;++ /** Sole constructor. */+ public IntBlockTermState() {+ skipOffset = -1;+ lastPosBlockOffset = -1;+ singletonDocID = -1;+ }@Overridepublic IntBlockTermState clone() {