Class UniformSplitTermsReader
- java.lang.Object
-
- org.apache.lucene.index.Fields
-
- org.apache.lucene.codecs.FieldsProducer
-
- org.apache.lucene.codecs.uniformsplit.UniformSplitTermsReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<java.lang.String>
- Direct Known Subclasses:
STUniformSplitTermsReader
public class UniformSplitTermsReader extends FieldsProducer
A block-based terms index and dictionary based on the Uniform Split technique.- See Also:
UniformSplitTermsWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected IndexInput
blockInput
protected IndexInput
dictionaryInput
protected java.util.Map<java.lang.String,UniformSplitTerms>
fieldToTermsMap
protected PostingsReaderBase
postingsReader
protected java.util.Collection<java.lang.String>
sortedFieldNames
protected int
version
-
Fields inherited from class org.apache.lucene.index.Fields
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description UniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, boolean dictionaryOnHeap)
protected
UniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, boolean dictionaryOnHeap, FieldMetadata.Serializer fieldMetadataReader, java.lang.String codecName, int versionStart, int versionCurrent, java.lang.String termsBlocksExtension, java.lang.String dictionaryExtension)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIntegrity()
Checks consistency of this reader.void
close()
protected IndexDictionary.BrowserSupplier
createDictionaryBrowserSupplier(SegmentReadState state, IndexInput dictionaryInput, FieldMetadata fieldMetadata, BlockDecoder blockDecoder, boolean dictionaryOnHeap)
protected void
fillFieldMap(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, boolean dictionaryOnHeap, IndexInput dictionaryInput, IndexInput blockInput, java.util.Collection<FieldMetadata> fieldMetadataCollection, FieldInfos fieldInfos)
java.util.Iterator<java.lang.String>
iterator()
Returns an iterator that will step through all fields names.protected java.util.Collection<FieldMetadata>
readEncodedFieldsMetadata(int numFields, DataInput metadataInput, BlockDecoder blockDecoder, FieldInfos fieldInfos, FieldMetadata.Serializer fieldMetadataReader, int maxNumDocs)
protected java.util.Collection<FieldMetadata>
readFieldsMetadata(IndexInput indexInput, BlockDecoder blockDecoder, FieldInfos fieldInfos, FieldMetadata.Serializer fieldMetadataReader, int maxNumDocs)
protected java.util.Collection<FieldMetadata>
readUnencodedFieldsMetadata(int numFields, DataInput metadataInput, FieldInfos fieldInfos, FieldMetadata.Serializer fieldMetadataReader, int maxNumDocs)
protected void
seekFieldsMetadata(IndexInput indexInput)
Positions the givenIndexInput
at the beginning of the fields metadata.int
size()
Returns the number of fields or -1 if the number of distinct field names is unknown.Terms
terms(java.lang.String field)
Get theTerms
for this field.-
Methods inherited from class org.apache.lucene.codecs.FieldsProducer
getMergeInstance
-
-
-
-
Field Detail
-
postingsReader
protected final PostingsReaderBase postingsReader
-
version
protected final int version
-
blockInput
protected final IndexInput blockInput
-
dictionaryInput
protected final IndexInput dictionaryInput
-
fieldToTermsMap
protected final java.util.Map<java.lang.String,UniformSplitTerms> fieldToTermsMap
-
sortedFieldNames
protected final java.util.Collection<java.lang.String> sortedFieldNames
-
-
Constructor Detail
-
UniformSplitTermsReader
public UniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, boolean dictionaryOnHeap) throws java.io.IOException
- Parameters:
blockDecoder
- Optional block decoder, may be null if none. It can be used for decompression or decryption.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.- Throws:
java.io.IOException
-
UniformSplitTermsReader
protected UniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, boolean dictionaryOnHeap, FieldMetadata.Serializer fieldMetadataReader, java.lang.String codecName, int versionStart, int versionCurrent, java.lang.String termsBlocksExtension, java.lang.String dictionaryExtension) throws java.io.IOException
- Throws:
java.io.IOException
- See Also:
UniformSplitTermsReader(PostingsReaderBase, SegmentReadState, BlockDecoder, boolean)
-
-
Method Detail
-
fillFieldMap
protected void fillFieldMap(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, boolean dictionaryOnHeap, IndexInput dictionaryInput, IndexInput blockInput, java.util.Collection<FieldMetadata> fieldMetadataCollection, FieldInfos fieldInfos) throws java.io.IOException
- Throws:
java.io.IOException
-
createDictionaryBrowserSupplier
protected IndexDictionary.BrowserSupplier createDictionaryBrowserSupplier(SegmentReadState state, IndexInput dictionaryInput, FieldMetadata fieldMetadata, BlockDecoder blockDecoder, boolean dictionaryOnHeap) throws java.io.IOException
- Throws:
java.io.IOException
-
readFieldsMetadata
protected java.util.Collection<FieldMetadata> readFieldsMetadata(IndexInput indexInput, BlockDecoder blockDecoder, FieldInfos fieldInfos, FieldMetadata.Serializer fieldMetadataReader, int maxNumDocs) throws java.io.IOException
- Parameters:
indexInput
-IndexInput
must be positioned to the fields metadata details by callingseekFieldsMetadata(IndexInput)
before this call.blockDecoder
- Optional block decoder, may be null if none.- Throws:
java.io.IOException
-
readEncodedFieldsMetadata
protected java.util.Collection<FieldMetadata> readEncodedFieldsMetadata(int numFields, DataInput metadataInput, BlockDecoder blockDecoder, FieldInfos fieldInfos, FieldMetadata.Serializer fieldMetadataReader, int maxNumDocs) throws java.io.IOException
- Throws:
java.io.IOException
-
readUnencodedFieldsMetadata
protected java.util.Collection<FieldMetadata> readUnencodedFieldsMetadata(int numFields, DataInput metadataInput, FieldInfos fieldInfos, FieldMetadata.Serializer fieldMetadataReader, int maxNumDocs) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classFieldsProducer
- Throws:
java.io.IOException
-
checkIntegrity
public void checkIntegrity() throws java.io.IOException
Description copied from class:FieldsProducer
Checks consistency of this reader.Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value against large data files.
- Specified by:
checkIntegrity
in classFieldsProducer
- Throws:
java.io.IOException
-
iterator
public java.util.Iterator<java.lang.String> iterator()
Description copied from class:Fields
Returns an iterator that will step through all fields names. This will not return null.
-
terms
public Terms terms(java.lang.String field)
Description copied from class:Fields
Get theTerms
for this field. This will return null if the field does not exist.
-
size
public int size()
Description copied from class:Fields
Returns the number of fields or -1 if the number of distinct field names is unknown. If >= 0,Fields.iterator()
will return as many field names.
-
seekFieldsMetadata
protected void seekFieldsMetadata(IndexInput indexInput) throws java.io.IOException
Positions the givenIndexInput
at the beginning of the fields metadata.- Throws:
java.io.IOException
-
-