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 = SortingAtomicReader.wrap(SlowCompositeReaderWrapper.wrap(reader), sorter); writer.addIndexes(reader); writer.close(); reader.close();
FilterAtomicReader.FilterDocsAndPositionsEnum, FilterAtomicReader.FilterDocsEnum, FilterAtomicReader.FilterFields, FilterAtomicReader.FilterTerms, FilterAtomicReader.FilterTermsEnumIndexReader.ReaderClosedListener| Modifier and Type | Method and Description |
|---|---|
void |
document(int docID,
StoredFieldVisitor visitor)
Expert: visits the fields of a stored document, for
custom processing/loading of each field.
|
Fields |
fields()
Returns
Fields for this reader. |
BinaryDocValues |
getBinaryDocValues(String field)
Returns
BinaryDocValues for this field, or
null if no BinaryDocValues were indexed for
this field. |
Bits |
getDocsWithField(String field)
Returns a
Bits at the size of reader.maxDoc(),
with turned on bits for each docid that does have a value for this field,
or null if no DocValues were indexed for this field. |
Bits |
getLiveDocs()
Returns the
Bits representing live (not
deleted) docs. |
NumericDocValues |
getNormValues(String field)
Returns
NumericDocValues representing norms
for this field, or null if no NumericDocValues
were indexed. |
NumericDocValues |
getNumericDocValues(String field)
Returns
NumericDocValues for this field, or
null if no NumericDocValues were indexed for
this field. |
SortedDocValues |
getSortedDocValues(String field)
Returns
SortedDocValues for this field, or
null if no SortedDocValues were indexed for
this field. |
SortedSetDocValues |
getSortedSetDocValues(String field)
Returns
SortedSetDocValues for this field, or
null if no SortedSetDocValues were indexed for
this field. |
Fields |
getTermVectors(int docID)
Retrieve term vectors for this document, or null if
term vectors were not indexed.
|
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. |
getFieldInfos, maxDoc, numDocs, toStringdocFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, hasNorms, termDocsEnum, termPositionsEnum, terms, totalTermFreqaddReaderClosedListener, close, decRef, document, document, equals, getCombinedCoreAndDeletesKey, getCoreCacheKey, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, open, open, open, open, open, registerParentReader, removeReaderClosedListener, tryIncRefpublic 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.IOExceptionpublic 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
IndexReaderIndexReader.document(int). If you want to load a subset, use
DocumentStoredFieldVisitor.document in class FilterAtomicReaderIOExceptionpublic Fields fields() throws IOException
AtomicReaderFields for this reader.
This method may return null if the reader has no
postings.fields in class FilterAtomicReaderIOExceptionpublic BinaryDocValues getBinaryDocValues(String field) throws IOException
AtomicReaderBinaryDocValues for this field, or
null if no BinaryDocValues were indexed for
this field. The returned instance should only be
used by a single thread.getBinaryDocValues in class FilterAtomicReaderIOExceptionpublic Bits getLiveDocs()
AtomicReaderBits representing 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.getLiveDocs in class FilterAtomicReaderpublic NumericDocValues getNormValues(String field) throws IOException
AtomicReaderNumericDocValues representing norms
for this field, or null if no NumericDocValues
were indexed. The returned instance should only be
used by a single thread.getNormValues in class FilterAtomicReaderIOExceptionpublic NumericDocValues getNumericDocValues(String field) throws IOException
AtomicReaderNumericDocValues for this field, or
null if no NumericDocValues were indexed for
this field. The returned instance should only be
used by a single thread.getNumericDocValues in class FilterAtomicReaderIOExceptionpublic SortedDocValues getSortedDocValues(String field) throws IOException
AtomicReaderSortedDocValues for this field, or
null if no SortedDocValues were indexed for
this field. The returned instance should only be
used by a single thread.getSortedDocValues in class FilterAtomicReaderIOExceptionpublic SortedSetDocValues getSortedSetDocValues(String field) throws IOException
AtomicReaderSortedSetDocValues for this field, or
null if no SortedSetDocValues were indexed for
this field. The returned instance should only be
used by a single thread.getSortedSetDocValues in class FilterAtomicReaderIOExceptionpublic Bits getDocsWithField(String field) throws IOException
AtomicReaderBits at the size of reader.maxDoc(),
with turned on bits for each docid that does have a value for this field,
or null if no DocValues were indexed for this field. The
returned instance should only be used by a single threadgetDocsWithField in class FilterAtomicReaderIOExceptionpublic Fields getTermVectors(int docID) throws IOException
IndexReadergetTermVectors in class FilterAtomicReaderIOExceptionCopyright © 2010 - 2020 Adobe. All Rights Reserved