LUCENE-8906: Lucene50PostingsFormat.IntBlockTermState becomes public

This commit is contained in:
Bruno Roustant 2019-08-02 00:18:12 +02:00 committed by David Smiley
parent ab470a6564
commit 52b5ec8068
2 changed files with 33 additions and 10 deletions

View File

@ -78,6 +78,9 @@ Improvements
* LUCENE-8916: GraphTokenStreamFiniteStrings preserves all Token attributes
through 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 skip

View File

@ -453,15 +453,35 @@ 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;
}
@Override
public IntBlockTermState clone() {