public final class SegmentReader extends CodecReader
Instances pointing to the same segment (but with different deletes, etc) may share the same core data.
IndexReader.CacheHelper, IndexReader.CacheKey, IndexReader.ClosedListener
NULL_ACCOUNTABLE
Modifier and Type | Method and Description |
---|---|
void |
checkIntegrity()
Checks consistency of this reader.
|
Directory |
directory()
Returns the directory this index resides in.
|
protected void |
doClose()
Implements close.
|
IndexReader.CacheHelper |
getCoreCacheHelper()
Optional method: Return a
IndexReader.CacheHelper that can be used to cache
based on the content of this leaf regardless of deletions. |
DocValuesProducer |
getDocValuesReader()
Expert: retrieve underlying DocValuesProducer
|
FieldInfos |
getFieldInfos()
Get the
FieldInfos describing all fields in
this reader. |
StoredFieldsReader |
getFieldsReader()
Expert: retrieve thread-private StoredFieldsReader
|
Bits |
getHardLiveDocs()
Returns the live docs that are not hard-deleted.
|
Bits |
getLiveDocs()
Returns the
Bits representing live (not
deleted) docs. |
LeafMetaData |
getMetaData()
Return metadata about this leaf.
|
NormsProducer |
getNormsReader()
Expert: retrieve underlying NormsProducer
|
PointsReader |
getPointsReader()
Expert: retrieve underlying PointsReader
|
FieldsProducer |
getPostingsReader()
Expert: retrieve underlying FieldsProducer
|
IndexReader.CacheHelper |
getReaderCacheHelper()
Optional method: Return a
IndexReader.CacheHelper that can be used to cache
based on the content of this reader. |
SegmentCommitInfo |
getSegmentInfo()
Return the SegmentInfoPerCommit of the segment this reader is reading.
|
String |
getSegmentName()
Return the name of the segment this reader is reading.
|
TermVectorsReader |
getTermVectorsReader()
Expert: retrieve thread-private TermVectorsReader
|
int |
maxDoc()
Returns one greater than the largest possible document number.
|
int |
numDocs()
Returns the number of documents in this index.
|
String |
toString() |
document, getBinaryDocValues, getChildResources, getNormValues, getNumericDocValues, getPointValues, getSortedDocValues, getSortedNumericDocValues, getSortedSetDocValues, getTermVectors, ramBytesUsed, terms
docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, postings, postings, totalTermFreq
close, decRef, document, document, ensureOpen, equals, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, registerParentReader, tryIncRef
public Bits getLiveDocs()
LeafReader
Bits
representing live (not
deleted) docs. A set bit indicates the doc ID has not
been deleted. If this method returns null it means
there are no deleted documents (all documents are
live).
The returned instance has been safely published for
use by multiple threads without additional
synchronization.getLiveDocs
in class LeafReader
protected void doClose() throws IOException
IndexReader
doClose
in class CodecReader
IOException
public FieldInfos getFieldInfos()
LeafReader
FieldInfos
describing all fields in
this reader.
Note: Implementations should cache the FieldInfos
instance returned by this method such that subsequent
calls to this method return the same instance.getFieldInfos
in class LeafReader
public int numDocs()
IndexReader
NOTE: This operation may run in O(maxDoc). Implementations that can't return this number in constant-time should cache it.
numDocs
in class IndexReader
public int maxDoc()
IndexReader
maxDoc
in class IndexReader
public TermVectorsReader getTermVectorsReader()
CodecReader
getTermVectorsReader
in class CodecReader
public StoredFieldsReader getFieldsReader()
CodecReader
getFieldsReader
in class CodecReader
public PointsReader getPointsReader()
CodecReader
getPointsReader
in class CodecReader
public NormsProducer getNormsReader()
CodecReader
getNormsReader
in class CodecReader
public DocValuesProducer getDocValuesReader()
CodecReader
getDocValuesReader
in class CodecReader
public FieldsProducer getPostingsReader()
CodecReader
getPostingsReader
in class CodecReader
public String getSegmentName()
public SegmentCommitInfo getSegmentInfo()
public Directory directory()
public IndexReader.CacheHelper getReaderCacheHelper()
IndexReader
IndexReader.CacheHelper
that can be used to cache
based on the content of this reader. Two readers that have different data
or different sets of deleted documents will be considered different.
A return value of null
indicates that this reader is not suited
for caching, which is typically the case for short-lived wrappers that
alter the content of the wrapped reader.
getReaderCacheHelper
in class IndexReader
public IndexReader.CacheHelper getCoreCacheHelper()
LeafReader
IndexReader.CacheHelper
that can be used to cache
based on the content of this leaf regardless of deletions. Two readers
that have the same data but different sets of deleted documents or doc
values updates may be considered equal. Consider using
IndexReader.getReaderCacheHelper()
if you need deletions or dv updates to be
taken into account.
A return value of null
indicates that this reader is not suited
for caching, which is typically the case for short-lived wrappers that
alter the content of the wrapped leaf reader.
getCoreCacheHelper
in class LeafReader
public LeafMetaData getMetaData()
LeafReader
getMetaData
in class LeafReader
public Bits getHardLiveDocs()
public void checkIntegrity() throws IOException
LeafReader
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 CodecReader
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.