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 long
BASE_RAM_USAGE
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 static int
VERSION_START
-
Fields inherited from class org.apache.lucene.index.Fields
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description UniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder)
protected
UniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, java.lang.String codecName, int versionStart, int versionCurrent, java.lang.String termsBlocksExtension, java.lang.String dictionaryExtension)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIntegrity()
Checks consistency of this reader.void
close()
protected void
fillFieldMap(PostingsReaderBase postingsReader, BlockDecoder blockDecoder, IndexInput dictionaryInput, IndexInput blockInput, java.util.Collection<FieldMetadata> fieldMetadataCollection, FieldInfos fieldInfos)
protected long
getTermsRamBytesUsed()
java.util.Iterator<java.lang.String>
iterator()
Returns an iterator that will step through all fields names.protected static java.util.Collection<FieldMetadata>
parseFieldsMetadata(IndexInput indexInput, FieldInfos fieldInfos)
long
ramBytesUsed()
Return the memory usage of this object in bytes.protected static 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
-
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
-
VERSION_START
protected static final int VERSION_START
- See Also:
- Constant Field Values
-
BASE_RAM_USAGE
private static final long BASE_RAM_USAGE
-
postingsReader
protected final PostingsReaderBase postingsReader
-
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) throws java.io.IOException
- Parameters:
blockDecoder
- Optional block decoder, may be null if none. It can be used for decompression or decryption.- Throws:
java.io.IOException
-
UniformSplitTermsReader
protected UniformSplitTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockDecoder blockDecoder, java.lang.String codecName, int versionStart, int versionCurrent, java.lang.String termsBlocksExtension, java.lang.String dictionaryExtension) throws java.io.IOException
- Parameters:
blockDecoder
- Optional block decoder, may be null if none. It can be used for decompression or decryption.- Throws:
java.io.IOException
-
-
Method Detail
-
fillFieldMap
protected void fillFieldMap(PostingsReaderBase postingsReader, BlockDecoder blockDecoder, IndexInput dictionaryInput, IndexInput blockInput, java.util.Collection<FieldMetadata> fieldMetadataCollection, FieldInfos fieldInfos) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFieldsMetadata
protected static java.util.Collection<FieldMetadata> parseFieldsMetadata(IndexInput indexInput, FieldInfos fieldInfos) throws java.io.IOException
- Parameters:
indexInput
-IndexInput
must be positioned to the fields metadata details by callingseekFieldsMetadata(IndexInput)
before this call.- 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.
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.
-
getTermsRamBytesUsed
protected long getTermsRamBytesUsed()
-
seekFieldsMetadata
protected static void seekFieldsMetadata(IndexInput indexInput) throws java.io.IOException
Positions the givenIndexInput
at the beginning of the fields metadata.- Throws:
java.io.IOException
-
-