org.apache.lucene.index.sorter
Class SortingAtomicReader
java.lang.Object
org.apache.lucene.index.IndexReader
org.apache.lucene.index.AtomicReader
org.apache.lucene.index.FilterAtomicReader
org.apache.lucene.index.sorter.SortingAtomicReader
- All Implemented Interfaces:
- Closeable
public class SortingAtomicReader
- extends FilterAtomicReader
An 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();
- WARNING: This API is experimental and might change in incompatible ways in the next release.
Methods inherited from class org.apache.lucene.index.IndexReader |
addReaderClosedListener, close, decRef, document, document, ensureOpen, equals, getCombinedCoreAndDeletesKey, getCoreCacheKey, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, open, open, open, open, open, registerParentReader, removeReaderClosedListener, tryIncRef |
wrap
public static AtomicReader wrap(AtomicReader reader,
Sorter sorter)
throws IOException
- Return a sorted view of
reader
according to the order
defined by sorter
. If the reader is already sorted, this
method might return the reader as-is.
- Throws:
IOException
wrap
public static AtomicReader wrap(AtomicReader reader,
Sorter.DocMap docMap)
- Expert: same as
wrap(AtomicReader, Sorter)
but operates directly on a Sorter.DocMap
.
document
public void document(int docID,
StoredFieldVisitor visitor)
throws IOException
- Overrides:
document
in class FilterAtomicReader
- Throws:
IOException
fields
public Fields fields()
throws IOException
- Overrides:
fields
in class FilterAtomicReader
- Throws:
IOException
getBinaryDocValues
public BinaryDocValues getBinaryDocValues(String field)
throws IOException
- Overrides:
getBinaryDocValues
in class FilterAtomicReader
- Throws:
IOException
getLiveDocs
public Bits getLiveDocs()
- Overrides:
getLiveDocs
in class FilterAtomicReader
getNormValues
public NumericDocValues getNormValues(String field)
throws IOException
- Overrides:
getNormValues
in class FilterAtomicReader
- Throws:
IOException
getNumericDocValues
public NumericDocValues getNumericDocValues(String field)
throws IOException
- Overrides:
getNumericDocValues
in class FilterAtomicReader
- Throws:
IOException
getSortedDocValues
public SortedDocValues getSortedDocValues(String field)
throws IOException
- Overrides:
getSortedDocValues
in class FilterAtomicReader
- Throws:
IOException
getSortedSetDocValues
public SortedSetDocValues getSortedSetDocValues(String field)
throws IOException
- Overrides:
getSortedSetDocValues
in class FilterAtomicReader
- Throws:
IOException
getDocsWithField
public Bits getDocsWithField(String field)
throws IOException
- Overrides:
getDocsWithField
in class FilterAtomicReader
- Throws:
IOException
getTermVectors
public Fields getTermVectors(int docID)
throws IOException
- Overrides:
getTermVectors
in class FilterAtomicReader
- Throws:
IOException
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.