Class Lucene90BlockTreeTermsReader
- java.lang.Object
-
- org.apache.lucene.index.Fields
-
- org.apache.lucene.codecs.FieldsProducer
-
- org.apache.lucene.codecs.lucene90.blocktree.Lucene90BlockTreeTermsReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Iterable<java.lang.String>
public final class Lucene90BlockTreeTermsReader extends FieldsProducer
A block-based terms index and dictionary that assigns terms to variable length blocks according to how they share prefixes. The terms index is a prefix trie whose leaves are term blocks. The advantage of this approach is that seekExact is often able to determine a term cannot exist without doing any IO, and intersection with Automata is very fast. Note that this terms dictionary has its own fixed terms index (ie, it does not support a pluggable terms index implementation).NOTE: this terms dictionary supports min/maxItemsPerBlock during indexing to control how much memory the terms index uses.
The data structure used by this implementation is very similar to a burst trie (http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.18.3499), but with added logic to break up too-large blocks of all terms sharing a given prefix into smaller ones.
Use
CheckIndexwith the-verboseoption to see summary statistics on the blocks in the dictionary.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>fieldListprivate java.util.Map<java.lang.String,FieldReader>fieldMap(package private) static Outputs<BytesRef>FST_OUTPUTS(package private) IndexInputindexIn(package private) static BytesRefNO_OUTPUT(package private) static intOUTPUT_FLAG_HAS_TERMS(package private) static intOUTPUT_FLAG_IS_FLOOR(package private) static intOUTPUT_FLAGS_MASK(package private) static intOUTPUT_FLAGS_NUM_BITS(package private) PostingsReaderBasepostingsReader(package private) java.lang.Stringsegment(package private) static java.lang.StringTERMS_CODEC_NAME(package private) static java.lang.StringTERMS_EXTENSIONExtension of terms file(package private) static java.lang.StringTERMS_INDEX_CODEC_NAME(package private) static java.lang.StringTERMS_INDEX_EXTENSIONExtension of terms index file(package private) static java.lang.StringTERMS_META_CODEC_NAME(package private) static java.lang.StringTERMS_META_EXTENSIONExtension of terms meta file(package private) IndexInputtermsIn(package private) intversionstatic intVERSION_CURRENTCurrent terms format.static intVERSION_STARTInitial terms format.-
Fields inherited from class org.apache.lucene.index.Fields
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description Lucene90BlockTreeTermsReader(PostingsReaderBase postingsReader, SegmentReadState state)Sole constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.StringbrToString(BytesRef b)voidcheckIntegrity()Checks consistency of this reader.voidclose()java.util.Iterator<java.lang.String>iterator()Returns an iterator that will step through all fields names.private static BytesRefreadBytesRef(IndexInput in)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.java.lang.StringtoString()-
Methods inherited from class org.apache.lucene.codecs.FieldsProducer
getMergeInstance
-
-
-
-
Field Detail
-
NO_OUTPUT
static final BytesRef NO_OUTPUT
-
OUTPUT_FLAGS_NUM_BITS
static final int OUTPUT_FLAGS_NUM_BITS
- See Also:
- Constant Field Values
-
OUTPUT_FLAGS_MASK
static final int OUTPUT_FLAGS_MASK
- See Also:
- Constant Field Values
-
OUTPUT_FLAG_IS_FLOOR
static final int OUTPUT_FLAG_IS_FLOOR
- See Also:
- Constant Field Values
-
OUTPUT_FLAG_HAS_TERMS
static final int OUTPUT_FLAG_HAS_TERMS
- See Also:
- Constant Field Values
-
TERMS_EXTENSION
static final java.lang.String TERMS_EXTENSION
Extension of terms file- See Also:
- Constant Field Values
-
TERMS_CODEC_NAME
static final java.lang.String TERMS_CODEC_NAME
- See Also:
- Constant Field Values
-
VERSION_START
public static final int VERSION_START
Initial terms format.- See Also:
- Constant Field Values
-
VERSION_CURRENT
public static final int VERSION_CURRENT
Current terms format.- See Also:
- Constant Field Values
-
TERMS_INDEX_EXTENSION
static final java.lang.String TERMS_INDEX_EXTENSION
Extension of terms index file- See Also:
- Constant Field Values
-
TERMS_INDEX_CODEC_NAME
static final java.lang.String TERMS_INDEX_CODEC_NAME
- See Also:
- Constant Field Values
-
TERMS_META_EXTENSION
static final java.lang.String TERMS_META_EXTENSION
Extension of terms meta file- See Also:
- Constant Field Values
-
TERMS_META_CODEC_NAME
static final java.lang.String TERMS_META_CODEC_NAME
- See Also:
- Constant Field Values
-
termsIn
final IndexInput termsIn
-
indexIn
final IndexInput indexIn
-
postingsReader
final PostingsReaderBase postingsReader
-
fieldMap
private final java.util.Map<java.lang.String,FieldReader> fieldMap
-
fieldList
private final java.util.List<java.lang.String> fieldList
-
segment
final java.lang.String segment
-
version
final int version
-
-
Constructor Detail
-
Lucene90BlockTreeTermsReader
public Lucene90BlockTreeTermsReader(PostingsReaderBase postingsReader, SegmentReadState state) throws java.io.IOException
Sole constructor.- Throws:
java.io.IOException
-
-
Method Detail
-
readBytesRef
private static BytesRef readBytesRef(IndexInput in) 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
-
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) throws java.io.IOException
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.
-
brToString
java.lang.String brToString(BytesRef b)
-
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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-