public class SortingLeafReader extends FilterLeafReader
LeafReader
which supports sorting documents by a given
Sort
. You can use this class to sort an index as follows:
IndexWriter writer; // writer to which the sorted index will be added DirectoryReader reader; // reader on the input index Sort sort; // determines how the documents are sorted LeafReader sortingReader = SortingLeafReader.wrap(SlowCompositeReaderWrapper.wrap(reader), sort); writer.addIndexes(reader); writer.close(); reader.close();
FilterLeafReader.FilterFields, FilterLeafReader.FilterPostingsEnum, FilterLeafReader.FilterTerms, FilterLeafReader.FilterTermsEnum
LeafReader.CoreClosedListener
IndexReader.ReaderClosedListener
in
Modifier and Type | Method and Description |
---|---|
void |
document(int docID,
StoredFieldVisitor visitor) |
Fields |
fields() |
BinaryDocValues |
getBinaryDocValues(String field) |
Bits |
getDocsWithField(String field) |
Bits |
getLiveDocs() |
NumericDocValues |
getNormValues(String field) |
NumericDocValues |
getNumericDocValues(String field) |
SortedDocValues |
getSortedDocValues(String field) |
SortedNumericDocValues |
getSortedNumericDocValues(String field) |
SortedSetDocValues |
getSortedSetDocValues(String field) |
Fields |
getTermVectors(int docID) |
String |
toString() |
static LeafReader |
wrap(LeafReader reader,
Sort sort)
Return a sorted view of
reader according to the order
defined by sort . |
addCoreClosedListener, checkIntegrity, doClose, getDelegate, getFieldInfos, maxDoc, numDocs, removeCoreClosedListener, unwrap
addCoreClosedListenerAsReaderClosedListener, docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, postings, postings, removeCoreClosedListenerAsReaderClosedListener, termDocsEnum, termPositionsEnum, terms, totalTermFreq
addReaderClosedListener, close, decRef, document, document, ensureOpen, equals, getCombinedCoreAndDeletesKey, getCoreCacheKey, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, registerParentReader, removeReaderClosedListener, tryIncRef
public static LeafReader wrap(LeafReader reader, Sort sort) throws IOException
reader
according to the order
defined by sort
. If the reader is already sorted, this
method might return the reader as-is.IOException
public void document(int docID, StoredFieldVisitor visitor) throws IOException
document
in class FilterLeafReader
IOException
public Fields fields() throws IOException
fields
in class FilterLeafReader
IOException
public BinaryDocValues getBinaryDocValues(String field) throws IOException
getBinaryDocValues
in class FilterLeafReader
IOException
public Bits getLiveDocs()
getLiveDocs
in class FilterLeafReader
public NumericDocValues getNormValues(String field) throws IOException
getNormValues
in class FilterLeafReader
IOException
public NumericDocValues getNumericDocValues(String field) throws IOException
getNumericDocValues
in class FilterLeafReader
IOException
public SortedNumericDocValues getSortedNumericDocValues(String field) throws IOException
getSortedNumericDocValues
in class FilterLeafReader
IOException
public SortedDocValues getSortedDocValues(String field) throws IOException
getSortedDocValues
in class FilterLeafReader
IOException
public SortedSetDocValues getSortedSetDocValues(String field) throws IOException
getSortedSetDocValues
in class FilterLeafReader
IOException
public Bits getDocsWithField(String field) throws IOException
getDocsWithField
in class FilterLeafReader
IOException
public Fields getTermVectors(int docID) throws IOException
getTermVectors
in class FilterLeafReader
IOException
public String toString()
toString
in class FilterLeafReader
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.