org.apache.lucene.index.sorter
public class SortingAtomicReader extends FilterAtomicReader
AtomicReader
which supports sorting documents by a given
Sorter
. 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 Sorter sorter; // determines how the documents are sorted AtomicReader sortingReader = new SortingAtomicReader(reader, sorter); writer.addIndexes(reader); writer.close(); reader.close();
FilterAtomicReader.FilterDocsAndPositionsEnum, FilterAtomicReader.FilterDocsEnum, FilterAtomicReader.FilterFields, FilterAtomicReader.FilterTerms, FilterAtomicReader.FilterTermsEnum
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) |
SortedSetDocValues |
getSortedSetDocValues(String field) |
Fields |
getTermVectors(int docID) |
static AtomicReader |
wrap(AtomicReader reader,
Sorter.DocMap docMap)
Expert: same as
wrap(AtomicReader, Sorter) but operates directly on a Sorter.DocMap . |
static AtomicReader |
wrap(AtomicReader reader,
Sorter sorter)
Return a sorted view of
reader according to the order
defined by sorter . |
doClose, getFieldInfos, maxDoc, numDocs, toString
docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, hasNorms, termDocsEnum, termPositionsEnum, terms, totalTermFreq
addReaderClosedListener, close, decRef, document, document, ensureOpen, equals, getCombinedCoreAndDeletesKey, getCoreCacheKey, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, open, open, open, open, open, registerParentReader, removeReaderClosedListener, tryIncRef
public static AtomicReader wrap(AtomicReader reader, Sorter sorter) throws IOException
reader
according to the order
defined by sorter
. If the reader is already sorted, this
method might return the reader as-is.IOException
public static AtomicReader wrap(AtomicReader reader, Sorter.DocMap docMap)
wrap(AtomicReader, Sorter)
but operates directly on a Sorter.DocMap
.public void document(int docID, StoredFieldVisitor visitor) throws IOException
document
in class FilterAtomicReader
IOException
public Fields fields() throws IOException
fields
in class FilterAtomicReader
IOException
public BinaryDocValues getBinaryDocValues(String field) throws IOException
getBinaryDocValues
in class FilterAtomicReader
IOException
public Bits getLiveDocs()
getLiveDocs
in class FilterAtomicReader
public NumericDocValues getNormValues(String field) throws IOException
getNormValues
in class FilterAtomicReader
IOException
public NumericDocValues getNumericDocValues(String field) throws IOException
getNumericDocValues
in class FilterAtomicReader
IOException
public SortedDocValues getSortedDocValues(String field) throws IOException
getSortedDocValues
in class FilterAtomicReader
IOException
public SortedSetDocValues getSortedSetDocValues(String field) throws IOException
getSortedSetDocValues
in class FilterAtomicReader
IOException
public Bits getDocsWithField(String field) throws IOException
getDocsWithField
in class FilterAtomicReader
IOException
public Fields getTermVectors(int docID) throws IOException
getTermVectors
in class FilterAtomicReader
IOException
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.