public class BlockTreeTermsReader extends FieldsProducer
NOTE: this terms dictionary does not support index divisor when opening an IndexReader. Instead, you can change the min/maxItemsPerBlock during indexing.
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.
EMPTY_ARRAY| Constructor and Description |
|---|
BlockTreeTermsReader(Directory dir,
FieldInfos fieldInfos,
SegmentInfo info,
PostingsReaderBase postingsReader,
IOContext ioContext,
String segmentSuffix,
int indexDivisor)
Sole constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkIntegrity()
Checks consistency of this reader.
|
void |
close() |
Iterator<String> |
iterator()
Returns an iterator that will step through all fields
names.
|
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
protected int |
readHeader(IndexInput input)
Reads terms file header.
|
protected int |
readIndexHeader(IndexInput input)
Reads index file header.
|
protected void |
seekDir(IndexInput input,
long dirOffset)
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(String field)
Get the
Terms for this field. |
getUniqueTermCountpublic BlockTreeTermsReader(Directory dir, FieldInfos fieldInfos, SegmentInfo info, PostingsReaderBase postingsReader, IOContext ioContext, String segmentSuffix, int indexDivisor) throws IOException
IOExceptionprotected int readHeader(IndexInput input) throws IOException
IOExceptionprotected int readIndexHeader(IndexInput input) throws IOException
IOExceptionprotected void seekDir(IndexInput input, long dirOffset) throws IOException
input to the directory offset.IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FieldsProducerIOExceptionpublic Iterator<String> iterator()
Fieldspublic Terms terms(String field) throws IOException
FieldsTerms for this field. This will return
null if the field does not exist.terms in class FieldsIOExceptionpublic int size()
FieldsFields.iterator() will return as many field names.public long ramBytesUsed()
Accountablepublic void checkIntegrity()
throws IOException
FieldsProducerNote 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 FieldsProducerIOExceptionCopyright © 2000-2014 Apache Software Foundation. All Rights Reserved.