Package org.apache.lucene.index
Class SortingLeafReader
- java.lang.Object
-
- org.apache.lucene.index.IndexReader
-
- org.apache.lucene.index.LeafReader
-
- org.apache.lucene.index.FilterLeafReader
-
- org.apache.lucene.index.SortingLeafReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
class SortingLeafReader extends FilterLeafReader
AnLeafReaderwhich supports sorting documents by a givenSort. This is package private and is only used by Lucene for BWC when it needs to merge an unsorted flushed segment built by an older version (newly flushed segments are sorted since version 7.0).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSortingLeafReader.CachedBinaryDVs(package private) static classSortingLeafReader.CachedNumericDVs(package private) static classSortingLeafReader.SortingBinaryDocValuesprivate static classSortingLeafReader.SortingBits(package private) static classSortingLeafReader.SortingDocsEnum(package private) static classSortingLeafReader.SortingFields(package private) static classSortingLeafReader.SortingNumericDocValuesprivate static classSortingLeafReader.SortingPointValues(package private) static classSortingLeafReader.SortingPostingsEnum(package private) static classSortingLeafReader.SortingSortedDocValues(package private) static classSortingLeafReader.SortingSortedNumericDocValues(package private) static classSortingLeafReader.SortingSortedSetDocValuesprivate static classSortingLeafReader.SortingTermsprivate static classSortingLeafReader.SortingTermsEnum-
Nested classes/interfaces inherited from class org.apache.lucene.index.FilterLeafReader
FilterLeafReader.FilterFields, FilterLeafReader.FilterPostingsEnum, FilterLeafReader.FilterTerms, FilterLeafReader.FilterTermsEnum
-
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 private java.util.Map<java.lang.String,SortingLeafReader.CachedBinaryDVs>cachedBinaryDVsprivate java.util.Map<java.lang.String,SortingLeafReader.CachedNumericDVs>cachedNormsprivate java.util.Map<java.lang.String,SortingLeafReader.CachedNumericDVs>cachedNumericDVsprivate java.util.Map<java.lang.String,int[]>cachedSortedDVsprivate java.util.Map<java.lang.String,long[][]>cachedSortedNumericDVsprivate java.util.Map<java.lang.String,long[][]>cachedSortedSetDVs(package private) Sorter.DocMapdocMap-
Fields inherited from class org.apache.lucene.index.FilterLeafReader
in
-
-
Constructor Summary
Constructors Modifier Constructor Description privateSortingLeafReader(LeafReader in, Sorter.DocMap docMap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.BitsgetLiveDocs()Returns theBitsrepresenting live (not deleted) docs.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.Termsterms(java.lang.String field)Returns theTermsindex for this field, or null if it has none.java.lang.StringtoString()(package private) static LeafReaderwrap(LeafReader reader, Sorter.DocMap docMap)Expert: same aswrap(org.apache.lucene.index.LeafReader, Sort)but operates directly on aSorter.DocMap.static LeafReaderwrap(LeafReader reader, Sort sort)Return a sorted view ofreaderaccording to the order defined bysort.-
Methods inherited from class org.apache.lucene.index.FilterLeafReader
checkIntegrity, doClose, getDelegate, getFieldInfos, getMetaData, maxDoc, numDocs, unwrap
-
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
-
cachedNumericDVs
private final java.util.Map<java.lang.String,SortingLeafReader.CachedNumericDVs> cachedNumericDVs
-
cachedBinaryDVs
private final java.util.Map<java.lang.String,SortingLeafReader.CachedBinaryDVs> cachedBinaryDVs
-
cachedSortedDVs
private final java.util.Map<java.lang.String,int[]> cachedSortedDVs
-
cachedSortedSetDVs
private final java.util.Map<java.lang.String,long[][]> cachedSortedSetDVs
-
cachedSortedNumericDVs
private final java.util.Map<java.lang.String,long[][]> cachedSortedNumericDVs
-
docMap
final Sorter.DocMap docMap
-
cachedNorms
private final java.util.Map<java.lang.String,SortingLeafReader.CachedNumericDVs> cachedNorms
-
-
Constructor Detail
-
SortingLeafReader
private SortingLeafReader(LeafReader in, Sorter.DocMap docMap)
-
-
Method Detail
-
wrap
public static LeafReader wrap(LeafReader reader, Sort sort) throws java.io.IOException
Return a sorted view ofreaderaccording to the order defined bysort. If the reader is already sorted, this method might return the reader as-is.- Throws:
java.io.IOException
-
wrap
static LeafReader wrap(LeafReader reader, Sorter.DocMap docMap)
Expert: same aswrap(org.apache.lucene.index.LeafReader, Sort)but operates directly on aSorter.DocMap.
-
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.- Overrides:
documentin classFilterLeafReader- Throws:
java.io.IOException
-
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.- Overrides:
termsin classFilterLeafReader- 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.- Overrides:
getBinaryDocValuesin classFilterLeafReader- Throws:
java.io.IOException
-
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.- Overrides:
getLiveDocsin classFilterLeafReader
-
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.- Overrides:
getPointValuesin classFilterLeafReader- 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.- Overrides:
getNormValuesin classFilterLeafReader- 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.- Overrides:
getNumericDocValuesin classFilterLeafReader- 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.- Overrides:
getSortedNumericDocValuesin classFilterLeafReader- 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.- Overrides:
getSortedDocValuesin classFilterLeafReader- 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.- Overrides:
getSortedSetDocValuesin classFilterLeafReader- 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).- Overrides:
getTermVectorsin classFilterLeafReader- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classFilterLeafReader
-
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
-
-