Class UniformSplitPostingsFormat
- java.lang.Object
-
- org.apache.lucene.codecs.PostingsFormat
-
- org.apache.lucene.codecs.uniformsplit.UniformSplitPostingsFormat
-
- All Implemented Interfaces:
NamedSPILoader.NamedSPI
- Direct Known Subclasses:
STUniformSplitPostingsFormat
public class UniformSplitPostingsFormat extends PostingsFormat
PostingsFormat
based on the Uniform Split technique.- See Also:
UniformSplitTermsWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockDecoder
blockDecoder
protected BlockEncoder
blockEncoder
protected int
deltaNumLines
protected boolean
dictionaryOnHeap
static java.lang.String
NAME
protected int
targetNumBlockLines
static java.lang.String
TERMS_BLOCKS_EXTENSION
Extension of the file containing the terms blocks for each field and the fields metadata.static java.lang.String
TERMS_DICTIONARY_EXTENSION
Extension of the file containing the terms dictionary (the FST "trie").static int
VERSION_CURRENT
static int
VERSION_ENCODABLE_FIELDS_METADATA
static int
VERSION_START
-
Fields inherited from class org.apache.lucene.codecs.PostingsFormat
EMPTY
-
-
Constructor Summary
Constructors Modifier Constructor Description UniformSplitPostingsFormat()
Creates aUniformSplitPostingsFormat
with default settings.UniformSplitPostingsFormat(int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder, BlockDecoder blockDecoder, boolean dictionaryOnHeap)
protected
UniformSplitPostingsFormat(java.lang.String name, int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder, BlockDecoder blockDecoder, boolean dictionaryOnHeap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FieldsProducer
createUniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder)
protected FieldsConsumer
createUniformSplitTermsWriter(PostingsWriterBase postingsWriter, SegmentWriteState state, int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder)
FieldsConsumer
fieldsConsumer(SegmentWriteState state)
Writes a new segmentFieldsProducer
fieldsProducer(SegmentReadState state)
Reads a segment.private static void
validateBlockEncoder(BlockEncoder blockEncoder, BlockDecoder blockDecoder)
-
Methods inherited from class org.apache.lucene.codecs.PostingsFormat
availablePostingsFormats, forName, getName, reloadPostingsFormats, toString
-
-
-
-
Field Detail
-
TERMS_DICTIONARY_EXTENSION
public static final java.lang.String TERMS_DICTIONARY_EXTENSION
Extension of the file containing the terms dictionary (the FST "trie").- See Also:
- Constant Field Values
-
TERMS_BLOCKS_EXTENSION
public static final java.lang.String TERMS_BLOCKS_EXTENSION
Extension of the file containing the terms blocks for each field and the fields metadata.- See Also:
- Constant Field Values
-
VERSION_START
public static final int VERSION_START
- See Also:
- Constant Field Values
-
VERSION_ENCODABLE_FIELDS_METADATA
public static final int VERSION_ENCODABLE_FIELDS_METADATA
- See Also:
- Constant Field Values
-
VERSION_CURRENT
public static final int VERSION_CURRENT
- See Also:
- Constant Field Values
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
targetNumBlockLines
protected final int targetNumBlockLines
-
deltaNumLines
protected final int deltaNumLines
-
blockEncoder
protected final BlockEncoder blockEncoder
-
blockDecoder
protected final BlockDecoder blockDecoder
-
dictionaryOnHeap
protected final boolean dictionaryOnHeap
-
-
Constructor Detail
-
UniformSplitPostingsFormat
public UniformSplitPostingsFormat()
Creates aUniformSplitPostingsFormat
with default settings.
-
UniformSplitPostingsFormat
public UniformSplitPostingsFormat(int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder, BlockDecoder blockDecoder, boolean dictionaryOnHeap)
- Parameters:
targetNumBlockLines
- Target number of lines per block. Must be strictly greater than 0. The parameters can be pre-validated withUniformSplitTermsWriter.validateSettings(int, int)
. There is one term per block line, with its corresponding details (TermState
).deltaNumLines
- Maximum allowed delta variation of the number of lines per block. Must be greater than or equal to 0 and strictly less thantargetNumBlockLines
. The block size will betargetNumBlockLines
+-deltaNumLines
. The block size must always be less than or equal toUniformSplitTermsWriter.MAX_NUM_BLOCK_LINES
.blockEncoder
- Optional block encoder, may be null if none. If present, it is used to encode all terms blocks, as well as the FST dictionary and the fields metadata.blockDecoder
- Optional block decoder, may be null if none. If present, it is used to decode all terms blocks, as well as the FST dictionary and the fields metadata.dictionaryOnHeap
- Whether to force loading the terms dictionary on-heap. By default it is kept off-heap without impact on performance. If block encoding/decoding is used, then the dictionary is always loaded on-heap whatever this parameter value is.
-
UniformSplitPostingsFormat
protected UniformSplitPostingsFormat(java.lang.String name, int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder, BlockDecoder blockDecoder, boolean dictionaryOnHeap)
-
-
Method Detail
-
fieldsConsumer
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws java.io.IOException
Description copied from class:PostingsFormat
Writes a new segment- Specified by:
fieldsConsumer
in classPostingsFormat
- Throws:
java.io.IOException
-
fieldsProducer
public FieldsProducer fieldsProducer(SegmentReadState state) throws java.io.IOException
Description copied from class:PostingsFormat
Reads a segment. NOTE: by the time this call returns, it must hold open any files it will need to use; else, those files may be deleted. Additionally, required files may be deleted during the execution of this call before there is a chance to open them. Under these circumstances an IOException should be thrown by the implementation. IOExceptions are expected and will automatically cause a retry of the segment opening logic with the newly revised segments.- Specified by:
fieldsProducer
in classPostingsFormat
- Throws:
java.io.IOException
-
createUniformSplitTermsWriter
protected FieldsConsumer createUniformSplitTermsWriter(PostingsWriterBase postingsWriter, SegmentWriteState state, int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder) throws java.io.IOException
- Throws:
java.io.IOException
-
createUniformSplitTermsReader
protected FieldsProducer createUniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder) throws java.io.IOException
- Throws:
java.io.IOException
-
validateBlockEncoder
private static void validateBlockEncoder(BlockEncoder blockEncoder, BlockDecoder blockDecoder)
-
-