Package org.apache.lucene.index
Class SortingCodecReader
- java.lang.Object
-
- org.apache.lucene.index.IndexReader
-
- org.apache.lucene.index.LeafReader
-
- org.apache.lucene.index.CodecReader
-
- org.apache.lucene.index.FilterCodecReader
-
- org.apache.lucene.index.SortingCodecReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public final class SortingCodecReader extends FilterCodecReader
AnCodecReaderwhich supports sorting documents by a givenSort. This can be used to re-sort and index after it's been created by wrapping all readers of the index with this reader and adding it to a fresh IndexWriter viaIndexWriter.addIndexes(CodecReader...). NOTE: This reader should only be used for merging. Pulling fields from this reader might be very costly and memory intensive.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
IndexReader.CacheHelper, IndexReader.CacheKey, IndexReader.ClosedListener
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.index.FilterCodecReader
in
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexReader.CacheHelpergetCoreCacheHelper()Optional method: Return aIndexReader.CacheHelperthat can be used to cache based on the content of this leaf regardless of deletions.DocValuesProducergetDocValuesReader()Expert: retrieve underlying DocValuesProducerStoredFieldsReadergetFieldsReader()Expert: retrieve underlying StoredFieldsReaderBitsgetLiveDocs()Returns theBitsrepresenting live (not deleted) docs.LeafMetaDatagetMetaData()Return metadata about this leaf.NormsProducergetNormsReader()Expert: retrieve underlying NormsProducerPointsReadergetPointsReader()Expert: retrieve underlying PointsReaderFieldsProducergetPostingsReader()Expert: retrieve underlying FieldsProducerIndexReader.CacheHelpergetReaderCacheHelper()Optional method: Return aIndexReader.CacheHelperthat can be used to cache based on the content of this reader.TermVectorsReadergetTermVectorsReader()Expert: retrieve underlying TermVectorsReaderKnnVectorsReadergetVectorReader()Expert: retrieve underlying VectorReaderStringtoString()static CodecReaderwrap(CodecReader reader, Sorter.DocMap docMap, Sort sort)Expert: same aswrap(org.apache.lucene.index.CodecReader, Sort)but operates directly on aSorter.DocMap.static CodecReaderwrap(CodecReader reader, Sort sort)Return a sorted view ofreaderaccording to the order defined bysort.-
Methods inherited from class org.apache.lucene.index.FilterCodecReader
checkIntegrity, doClose, document, getDelegate, getFieldInfos, getTermVectors, maxDoc, numDocs, unwrap
-
Methods inherited from class org.apache.lucene.index.CodecReader
getBinaryDocValues, getByteVectorValues, getFloatVectorValues, getNormValues, getNumericDocValues, getPointValues, getSortedDocValues, getSortedNumericDocValues, getSortedSetDocValues, searchNearestVectors, searchNearestVectors, storedFields, terms, termVectors
-
Methods inherited from class org.apache.lucene.index.LeafReader
docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, postings, postings, searchNearestVectors, searchNearestVectors, 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
-
-
-
-
Method Detail
-
wrap
public static CodecReader wrap(CodecReader reader, Sort sort) throws 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:
IOException
-
wrap
public static CodecReader wrap(CodecReader reader, Sorter.DocMap docMap, Sort sort)
Expert: same aswrap(org.apache.lucene.index.CodecReader, Sort)but operates directly on aSorter.DocMap.
-
getPostingsReader
public FieldsProducer getPostingsReader()
Description copied from class:CodecReaderExpert: retrieve underlying FieldsProducer- Overrides:
getPostingsReaderin classFilterCodecReader
-
getFieldsReader
public StoredFieldsReader getFieldsReader()
Description copied from class:CodecReaderExpert: retrieve underlying StoredFieldsReader- Overrides:
getFieldsReaderin classFilterCodecReader
-
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 classFilterCodecReader
-
getPointsReader
public PointsReader getPointsReader()
Description copied from class:CodecReaderExpert: retrieve underlying PointsReader- Overrides:
getPointsReaderin classFilterCodecReader
-
getVectorReader
public KnnVectorsReader getVectorReader()
Description copied from class:CodecReaderExpert: retrieve underlying VectorReader- Overrides:
getVectorReaderin classFilterCodecReader
-
getNormsReader
public NormsProducer getNormsReader()
Description copied from class:CodecReaderExpert: retrieve underlying NormsProducer- Overrides:
getNormsReaderin classFilterCodecReader
-
getDocValuesReader
public DocValuesProducer getDocValuesReader()
Description copied from class:CodecReaderExpert: retrieve underlying DocValuesProducer- Overrides:
getDocValuesReaderin classFilterCodecReader
-
getTermVectorsReader
public TermVectorsReader getTermVectorsReader()
Description copied from class:CodecReaderExpert: retrieve underlying TermVectorsReader- Overrides:
getTermVectorsReaderin classFilterCodecReader
-
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
-
getMetaData
public LeafMetaData getMetaData()
Description copied from class:LeafReaderReturn metadata about this leaf.- Overrides:
getMetaDatain classFilterCodecReader
-
-