public final class BlockTreeTermsReader extends FieldsProducer
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 CheckIndex
with the -verbose
option to see summary statistics on the blocks in the
dictionary.
See BlockTreeTermsWriter
.
Modifier and Type | Class and Description |
---|---|
static class |
BlockTreeTermsReader.FSTLoadMode
An enum that allows to control if term index FSTs are loaded into memory or read off-heap
|
Modifier and Type | Field and Description |
---|---|
private java.util.TreeMap<java.lang.String,FieldReader> |
fields |
static java.lang.String |
FST_MODE_KEY
Attribute key for fst mode.
|
(package private) static Outputs<BytesRef> |
FST_OUTPUTS |
(package private) IndexInput |
indexIn |
(package private) static BytesRef |
NO_OUTPUT |
(package private) static int |
OUTPUT_FLAG_HAS_TERMS |
(package private) static int |
OUTPUT_FLAG_IS_FLOOR |
(package private) static int |
OUTPUT_FLAGS_MASK |
(package private) static int |
OUTPUT_FLAGS_NUM_BITS |
(package private) PostingsReaderBase |
postingsReader |
(package private) java.lang.String |
segment |
(package private) static java.lang.String |
TERMS_CODEC_NAME |
(package private) static java.lang.String |
TERMS_EXTENSION
Extension of terms file
|
(package private) static java.lang.String |
TERMS_INDEX_CODEC_NAME |
(package private) static java.lang.String |
TERMS_INDEX_EXTENSION
Extension of terms index file
|
(package private) IndexInput |
termsIn |
(package private) int |
version |
static int |
VERSION_AUTO_PREFIX_TERMS_REMOVED
Auto-prefix terms have been superseded by points.
|
static int |
VERSION_CURRENT
Current terms format.
|
static int |
VERSION_START
Initial terms format.
|
EMPTY_ARRAY
Constructor and Description |
---|
BlockTreeTermsReader(PostingsReaderBase postingsReader,
SegmentReadState state,
BlockTreeTermsReader.FSTLoadMode defaultLoadMode)
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) java.lang.String |
brToString(BytesRef b) |
void |
checkIntegrity()
Checks consistency of this reader.
|
void |
close() |
java.util.Collection<Accountable> |
getChildResources()
Returns nested resources of this class.
|
private static BlockTreeTermsReader.FSTLoadMode |
getLoadMode(java.util.Map<java.lang.String,java.lang.String> attributes,
java.lang.String key,
BlockTreeTermsReader.FSTLoadMode defaultValue) |
java.util.Iterator<java.lang.String> |
iterator()
Returns an iterator that will step through all fields
names.
|
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
private static BytesRef |
readBytesRef(IndexInput in) |
private static void |
seekDir(IndexInput input)
Seek
input to the directory offset. |
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 the
Terms for this field. |
java.lang.String |
toString() |
getMergeInstance
public static final java.lang.String FST_MODE_KEY
static final BytesRef NO_OUTPUT
static final int OUTPUT_FLAGS_NUM_BITS
static final int OUTPUT_FLAGS_MASK
static final int OUTPUT_FLAG_IS_FLOOR
static final int OUTPUT_FLAG_HAS_TERMS
static final java.lang.String TERMS_EXTENSION
static final java.lang.String TERMS_CODEC_NAME
public static final int VERSION_START
public static final int VERSION_AUTO_PREFIX_TERMS_REMOVED
public static final int VERSION_CURRENT
static final java.lang.String TERMS_INDEX_EXTENSION
static final java.lang.String TERMS_INDEX_CODEC_NAME
final IndexInput termsIn
final IndexInput indexIn
final PostingsReaderBase postingsReader
private final java.util.TreeMap<java.lang.String,FieldReader> fields
final java.lang.String segment
final int version
public BlockTreeTermsReader(PostingsReaderBase postingsReader, SegmentReadState state, BlockTreeTermsReader.FSTLoadMode defaultLoadMode) throws java.io.IOException
java.io.IOException
private static BlockTreeTermsReader.FSTLoadMode getLoadMode(java.util.Map<java.lang.String,java.lang.String> attributes, java.lang.String key, BlockTreeTermsReader.FSTLoadMode defaultValue)
private static BytesRef readBytesRef(IndexInput in) throws java.io.IOException
java.io.IOException
private static void seekDir(IndexInput input) throws java.io.IOException
input
to the directory offset.java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class FieldsProducer
java.io.IOException
public java.util.Iterator<java.lang.String> iterator()
Fields
public Terms terms(java.lang.String field) throws java.io.IOException
Fields
Terms
for this field. This will return
null if the field does not exist.public int size()
Fields
Fields.iterator()
will return as many field names.java.lang.String brToString(BytesRef b)
public long ramBytesUsed()
Accountable
public java.util.Collection<Accountable> getChildResources()
Accountable
Accountables
public void checkIntegrity() throws java.io.IOException
FieldsProducer
Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value against large data files.
checkIntegrity
in class FieldsProducer
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object