public final class SegmentReader extends CodecReader
Instances pointing to the same segment (but with different deletes, etc) may share the same core data.
LeafReader.CoreClosedListenerIndexReader.ReaderClosedListener| Modifier and Type | Field and Description |
|---|---|
(package private) SegmentCoreReaders |
core |
(package private) DocValuesProducer |
docValuesProducer |
(package private) FieldInfos |
fieldInfos |
private Bits |
liveDocs |
private int |
numDocs |
(package private) SegmentDocValues |
segDocValues |
private SegmentCommitInfo |
si |
docsWithFieldLocal, docValuesLocal, normsLocal| Constructor and Description |
|---|
SegmentReader(SegmentCommitInfo si,
IOContext context)
Constructs a new SegmentReader with a new core.
|
SegmentReader(SegmentCommitInfo si,
SegmentReader sr)
Create new SegmentReader sharing core from a previous
SegmentReader and loading new live docs from a new
deletes file.
|
SegmentReader(SegmentCommitInfo si,
SegmentReader sr,
Bits liveDocs,
int numDocs)
Create new SegmentReader sharing core from a previous
SegmentReader and using the provided in-memory
liveDocs.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCoreClosedListener(LeafReader.CoreClosedListener listener)
Expert: adds a CoreClosedListener to this reader's shared core
|
Directory |
directory()
Returns the directory this index resides in.
|
protected void |
doClose()
Implements close.
|
java.lang.Object |
getCombinedCoreAndDeletesKey()
Expert: Returns a key for this IndexReader that also includes deletions,
so CachingWrapperFilter can find it again.
|
java.lang.Object |
getCoreCacheKey()
Expert: Returns a key for this IndexReader, so CachingWrapperFilter can find
it again.
|
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 |
getLiveDocs()
Returns the
Bits representing live (not
deleted) docs. |
NormsProducer |
getNormsReader()
Expert: retrieve underlying NormsProducer
|
PointsReader |
getPointsReader()
Expert: retrieve underlying PointsReader
|
PointValues |
getPointValues()
Returns the
PointValues used for numeric or
spatial searches, or null if there are no point fields. |
FieldsProducer |
getPostingsReader()
Expert: retrieve underlying FieldsProducer
|
SegmentCommitInfo |
getSegmentInfo()
Return the SegmentInfoPerCommit of the segment this reader is reading.
|
java.lang.String |
getSegmentName()
Return the name of the segment this reader is reading.
|
TermVectorsReader |
getTermVectorsReader()
Expert: retrieve thread-private TermVectorsReader
|
private DocValuesProducer |
initDocValuesProducer()
init most recent DocValues for the current commit
|
private FieldInfos |
initFieldInfos()
init most recent FieldInfos for the current commit
|
int |
maxDoc()
Returns one greater than the largest possible document number.
|
int |
numDocs()
Returns the number of documents in this index.
|
void |
removeCoreClosedListener(LeafReader.CoreClosedListener listener)
Expert: removes a CoreClosedListener from this reader's shared core
|
java.lang.String |
toString() |
checkIntegrity, document, fields, getBinaryDocValues, getChildResources, getDocsWithField, getNormValues, getNumericDocValues, getSortedDocValues, getSortedNumericDocValues, getSortedSetDocValues, getTermVectors, ramBytesUsedaddCoreClosedListenerAsReaderClosedListener, docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, postings, postings, removeCoreClosedListenerAsReaderClosedListener, terms, totalTermFreqaddReaderClosedListener, close, decRef, document, document, ensureOpen, equals, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, registerParentReader, removeReaderClosedListener, tryIncRefprivate final SegmentCommitInfo si
private final Bits liveDocs
private final int numDocs
final SegmentCoreReaders core
final SegmentDocValues segDocValues
final DocValuesProducer docValuesProducer
final FieldInfos fieldInfos
public SegmentReader(SegmentCommitInfo si, IOContext context) throws java.io.IOException
CorruptIndexException - if the index is corruptjava.io.IOException - if there is a low-level IO errorSegmentReader(SegmentCommitInfo si, SegmentReader sr) throws java.io.IOException
java.io.IOExceptionSegmentReader(SegmentCommitInfo si, SegmentReader sr, Bits liveDocs, int numDocs) throws java.io.IOException
java.io.IOExceptionprivate DocValuesProducer initDocValuesProducer() throws java.io.IOException
java.io.IOExceptionprivate FieldInfos initFieldInfos() throws java.io.IOException
java.io.IOExceptionpublic Bits getLiveDocs()
LeafReaderBits 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 LeafReaderprotected void doClose()
throws java.io.IOException
IndexReaderdoClose in class CodecReaderjava.io.IOExceptionpublic FieldInfos getFieldInfos()
LeafReaderFieldInfos describing all fields in
this reader.getFieldInfos in class LeafReaderpublic int numDocs()
IndexReadernumDocs in class IndexReaderpublic int maxDoc()
IndexReadermaxDoc in class IndexReaderpublic TermVectorsReader getTermVectorsReader()
CodecReadergetTermVectorsReader in class CodecReaderpublic StoredFieldsReader getFieldsReader()
CodecReadergetFieldsReader in class CodecReaderpublic PointValues getPointValues()
LeafReaderPointValues used for numeric or
spatial searches, or null if there are no point fields.getPointValues in class LeafReaderpublic NormsProducer getNormsReader()
CodecReadergetNormsReader in class CodecReaderpublic DocValuesProducer getDocValuesReader()
CodecReadergetDocValuesReader in class CodecReaderpublic FieldsProducer getPostingsReader()
CodecReadergetPostingsReader in class CodecReaderpublic PointsReader getPointsReader()
CodecReadergetPointsReader in class CodecReaderpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getSegmentName()
public SegmentCommitInfo getSegmentInfo()
public Directory directory()
public java.lang.Object getCoreCacheKey()
IndexReadergetCoreCacheKey in class IndexReaderpublic java.lang.Object getCombinedCoreAndDeletesKey()
IndexReadergetCombinedCoreAndDeletesKey in class IndexReaderpublic void addCoreClosedListener(LeafReader.CoreClosedListener listener)
LeafReaderaddCoreClosedListener in class LeafReaderpublic void removeCoreClosedListener(LeafReader.CoreClosedListener listener)
LeafReaderremoveCoreClosedListener in class LeafReader