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>,Accountable
- 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 private static longBASE_RAM_USAGEprotected IndexInputblockInputprotected IndexInputdictionaryInputprotected java.util.Map<java.lang.String,UniformSplitTerms>fieldToTermsMapprotected PostingsReaderBasepostingsReaderprotected java.util.Collection<java.lang.String>sortedFieldNamesprotected intversion-
Fields inherited from class org.apache.lucene.index.Fields
EMPTY_ARRAY
-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Modifier Constructor Description UniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, boolean dictionaryOnHeap)protectedUniformSplitTermsReader(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 voidcheckIntegrity()Checks consistency of this reader.voidclose()protected IndexDictionary.BrowserSuppliercreateDictionaryBrowserSupplier(SegmentReadState state, IndexInput dictionaryInput, FieldMetadata fieldMetadata, BlockDecoder blockDecoder, boolean dictionaryOnHeap)protected voidfillFieldMap(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, boolean dictionaryOnHeap, IndexInput dictionaryInput, IndexInput blockInput, java.util.Collection<FieldMetadata> fieldMetadataCollection, FieldInfos fieldInfos)protected longgetTermsRamBytesUsed()java.util.Iterator<java.lang.String>iterator()Returns an iterator that will step through all fields names.longramBytesUsed()Return the memory usage of this object in bytes.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 voidseekFieldsMetadata(IndexInput indexInput)Positions the givenIndexInputat the beginning of the fields metadata.intsize()Returns the number of fields or -1 if the number of distinct field names is unknown.Termsterms(java.lang.String field)Get theTermsfor this field.-
Methods inherited from class org.apache.lucene.codecs.FieldsProducer
getMergeInstance
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Field Detail
-
BASE_RAM_USAGE
private static final long BASE_RAM_USAGE
-
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-IndexInputmust 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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classFieldsProducer- Throws:
java.io.IOException
-
checkIntegrity
public void checkIntegrity() throws java.io.IOExceptionDescription copied from class:FieldsProducerChecks 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:
checkIntegrityin classFieldsProducer- Throws:
java.io.IOException
-
iterator
public java.util.Iterator<java.lang.String> iterator()
Description copied from class:FieldsReturns 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:FieldsGet theTermsfor this field. This will return null if the field does not exist.
-
size
public int size()
Description copied from class:FieldsReturns 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.
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.
-
getTermsRamBytesUsed
protected long getTermsRamBytesUsed()
-
seekFieldsMetadata
protected void seekFieldsMetadata(IndexInput indexInput) throws java.io.IOException
Positions the givenIndexInputat the beginning of the fields metadata.- Throws:
java.io.IOException
-
-