Package org.apache.lucene.index
Class MergeReaderWrapper
- java.lang.Object
-
- org.apache.lucene.index.IndexReader
-
- org.apache.lucene.index.LeafReader
-
- org.apache.lucene.index.MergeReaderWrapper
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
class MergeReaderWrapper extends LeafReader
This is a hack to make index sorting fast, with aLeafReaderthat always returns merge instances when you ask for the codec readers.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
IndexReader.CacheHelper, IndexReader.CacheKey, IndexReader.ClosedListener
-
-
Field Summary
Fields Modifier and Type Field Description (package private) DocValuesProducerdocValues(package private) FieldsProducerfields(package private) CodecReaderin(package private) NormsProducernorms(package private) StoredFieldsReaderstore(package private) TermVectorsReadervectors
-
Constructor Summary
Constructors Constructor Description MergeReaderWrapper(CodecReader in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckBounds(int docID)voidcheckIntegrity()Checks consistency of this reader.protected voiddoClose()Implements close.voiddocument(int docID, StoredFieldVisitor visitor)Expert: visits the fields of a stored document, for custom processing/loading of each field.BinaryDocValuesgetBinaryDocValues(java.lang.String field)ReturnsBinaryDocValuesfor this field, or null if no binary doc values were indexed for this field.IndexReader.CacheHelpergetCoreCacheHelper()Optional method: Return aIndexReader.CacheHelperthat can be used to cache based on the content of this leaf regardless of deletions.FieldInfosgetFieldInfos()Get theFieldInfosdescribing all fields in this reader.BitsgetLiveDocs()Returns theBitsrepresenting live (not deleted) docs.LeafMetaDatagetMetaData()Return metadata about this leaf.NumericDocValuesgetNormValues(java.lang.String field)ReturnsNumericDocValuesrepresenting norms for this field, or null if noNumericDocValueswere indexed.NumericDocValuesgetNumericDocValues(java.lang.String field)ReturnsNumericDocValuesfor this field, or null if no numeric doc values were indexed for this field.PointValuesgetPointValues(java.lang.String fieldName)Returns thePointValuesused for numeric or spatial searches for the given field, or null if there are no point fields.IndexReader.CacheHelpergetReaderCacheHelper()Optional method: Return aIndexReader.CacheHelperthat can be used to cache based on the content of this reader.SortedDocValuesgetSortedDocValues(java.lang.String field)ReturnsSortedDocValuesfor this field, or null if noSortedDocValueswere indexed for this field.SortedNumericDocValuesgetSortedNumericDocValues(java.lang.String field)ReturnsSortedNumericDocValuesfor this field, or null if noSortedNumericDocValueswere indexed for this field.SortedSetDocValuesgetSortedSetDocValues(java.lang.String field)ReturnsSortedSetDocValuesfor this field, or null if noSortedSetDocValueswere indexed for this field.FieldsgetTermVectors(int docID)Retrieve term vectors for this document, or null if term vectors were not indexed.intmaxDoc()Returns one greater than the largest possible document number.intnumDocs()Returns the number of documents in this index.Termsterms(java.lang.String field)Returns theTermsindex for this field, or null if it has none.java.lang.StringtoString()-
Methods inherited from class org.apache.lucene.index.LeafReader
docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, postings, postings, totalTermFreq
-
Methods inherited from class org.apache.lucene.index.IndexReader
close, decRef, document, document, ensureOpen, equals, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, notifyReaderClosedListeners, numDeletedDocs, registerParentReader, tryIncRef
-
-
-
-
Field Detail
-
in
final CodecReader in
-
fields
final FieldsProducer fields
-
norms
final NormsProducer norms
-
docValues
final DocValuesProducer docValues
-
store
final StoredFieldsReader store
-
vectors
final TermVectorsReader vectors
-
-
Constructor Detail
-
MergeReaderWrapper
MergeReaderWrapper(CodecReader in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
terms
public Terms terms(java.lang.String field) throws java.io.IOException
Description copied from class:LeafReaderReturns theTermsindex for this field, or null if it has none.- Specified by:
termsin classLeafReader- Throws:
java.io.IOException
-
getNumericDocValues
public NumericDocValues getNumericDocValues(java.lang.String field) throws java.io.IOException
Description copied from class:LeafReaderReturnsNumericDocValuesfor this field, or null if no numeric doc values were indexed for this field. The returned instance should only be used by a single thread.- Specified by:
getNumericDocValuesin classLeafReader- Throws:
java.io.IOException
-
getBinaryDocValues
public BinaryDocValues getBinaryDocValues(java.lang.String field) throws java.io.IOException
Description copied from class:LeafReaderReturnsBinaryDocValuesfor this field, or null if no binary doc values were indexed for this field. The returned instance should only be used by a single thread.- Specified by:
getBinaryDocValuesin classLeafReader- Throws:
java.io.IOException
-
getSortedDocValues
public SortedDocValues getSortedDocValues(java.lang.String field) throws java.io.IOException
Description copied from class:LeafReaderReturnsSortedDocValuesfor this field, or null if noSortedDocValueswere indexed for this field. The returned instance should only be used by a single thread.- Specified by:
getSortedDocValuesin classLeafReader- Throws:
java.io.IOException
-
getSortedNumericDocValues
public SortedNumericDocValues getSortedNumericDocValues(java.lang.String field) throws java.io.IOException
Description copied from class:LeafReaderReturnsSortedNumericDocValuesfor this field, or null if noSortedNumericDocValueswere indexed for this field. The returned instance should only be used by a single thread.- Specified by:
getSortedNumericDocValuesin classLeafReader- Throws:
java.io.IOException
-
getSortedSetDocValues
public SortedSetDocValues getSortedSetDocValues(java.lang.String field) throws java.io.IOException
Description copied from class:LeafReaderReturnsSortedSetDocValuesfor this field, or null if noSortedSetDocValueswere indexed for this field. The returned instance should only be used by a single thread.- Specified by:
getSortedSetDocValuesin classLeafReader- Throws:
java.io.IOException
-
getNormValues
public NumericDocValues getNormValues(java.lang.String field) throws java.io.IOException
Description copied from class:LeafReaderReturnsNumericDocValuesrepresenting norms for this field, or null if noNumericDocValueswere indexed. The returned instance should only be used by a single thread.- Specified by:
getNormValuesin classLeafReader- Throws:
java.io.IOException
-
getFieldInfos
public FieldInfos getFieldInfos()
Description copied from class:LeafReaderGet theFieldInfosdescribing 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.- Specified by:
getFieldInfosin classLeafReader
-
getLiveDocs
public Bits getLiveDocs()
Description copied from class:LeafReaderReturns theBitsrepresenting 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.- Specified by:
getLiveDocsin classLeafReader
-
checkIntegrity
public void checkIntegrity() throws java.io.IOExceptionDescription copied from class:LeafReaderChecks 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 classLeafReader- Throws:
java.io.IOException
-
getTermVectors
public Fields getTermVectors(int docID) throws java.io.IOException
Description copied from class:IndexReaderRetrieve term vectors for this document, or null if term vectors were not indexed. The returned Fields instance acts like a single-document inverted index (the docID will be 0).- Specified by:
getTermVectorsin classIndexReader- Throws:
java.io.IOException
-
getPointValues
public PointValues getPointValues(java.lang.String fieldName) throws java.io.IOException
Description copied from class:LeafReaderReturns thePointValuesused for numeric or spatial searches for the given field, or null if there are no point fields.- Specified by:
getPointValuesin classLeafReader- Throws:
java.io.IOException
-
numDocs
public int numDocs()
Description copied from class:IndexReaderReturns the number of documents in this index.NOTE: This operation may run in O(maxDoc). Implementations that can't return this number in constant-time should cache it.
- Specified by:
numDocsin classIndexReader
-
maxDoc
public int maxDoc()
Description copied from class:IndexReaderReturns one greater than the largest possible document number. This may be used to, e.g., determine how big to allocate an array which will have an element for every document number in an index.- Specified by:
maxDocin classIndexReader
-
document
public void document(int docID, StoredFieldVisitor visitor) throws java.io.IOExceptionDescription copied from class:IndexReaderExpert: visits the fields of a stored document, for custom processing/loading of each field. If you simply want to load all fields, useIndexReader.document(int). If you want to load a subset, useDocumentStoredFieldVisitor.- Specified by:
documentin classIndexReader- Throws:
java.io.IOException
-
doClose
protected void doClose() throws java.io.IOExceptionDescription copied from class:IndexReaderImplements close.- Specified by:
doClosein classIndexReader- Throws:
java.io.IOException
-
getCoreCacheHelper
public IndexReader.CacheHelper getCoreCacheHelper()
Description copied from class:LeafReaderOptional method: Return aIndexReader.CacheHelperthat 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 usingIndexReader.getReaderCacheHelper()if you need deletions or dv updates to be taken into account.A return value of
nullindicates 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.- Specified by:
getCoreCacheHelperin classLeafReader
-
getReaderCacheHelper
public IndexReader.CacheHelper getReaderCacheHelper()
Description copied from class:IndexReaderOptional method: Return aIndexReader.CacheHelperthat 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
nullindicates 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.- Specified by:
getReaderCacheHelperin classIndexReader
-
checkBounds
private void checkBounds(int docID)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getMetaData
public LeafMetaData getMetaData()
Description copied from class:LeafReaderReturn metadata about this leaf.- Specified by:
getMetaDatain classLeafReader
-
-