final class Sorter
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
Sorter.DocComparator
A comparator of doc IDs.
|
(package private) static class |
Sorter.DocMap
A permutation of doc IDs.
|
private static class |
Sorter.DocValueSorter |
(package private) static interface |
Sorter.NumericDocValuesSupplier |
(package private) static interface |
Sorter.SortedDocValuesSupplier |
| Constructor and Description |
|---|
Sorter(Sort sort)
Creates a new Sorter to sort the index with
sort |
| Modifier and Type | Method and Description |
|---|---|
(package private) static Sorter.DocComparator |
getDocComparator(int maxDoc,
SortField sortField,
Sorter.SortedDocValuesSupplier sortedProvider,
Sorter.NumericDocValuesSupplier numericProvider)
We cannot use the
FieldComparator API because that API requires that you send it docIDs in order. |
(package private) static Sorter.DocComparator |
getDocComparator(LeafReader reader,
SortField sortField) |
java.lang.String |
getID()
Returns the identifier of this
Sorter. |
(package private) static NumericDocValues |
getOrWrapNumeric(LeafReader reader,
SortField sortField)
Wraps a
SortedNumericDocValues as a single-valued view if the field is an instance of SortedNumericSortField,
returns NumericDocValues for the field otherwise. |
(package private) static SortedDocValues |
getOrWrapSorted(LeafReader reader,
SortField sortField)
Wraps a
SortedSetDocValues as a single-valued view if the field is an instance of SortedSetSortField,
returns SortedDocValues for the field otherwise. |
(package private) static SortField.Type |
getSortFieldType(SortField sortField)
Returns the native sort type for
SortedSetSortField and SortedNumericSortField,
SortField.getType() otherwise |
(package private) static boolean |
isConsistent(Sorter.DocMap docMap)
Check consistency of a
Sorter.DocMap, useful for assertions. |
private static Sorter.DocMap |
sort(int maxDoc,
Sorter.DocComparator comparator)
Computes the old-to-new permutation over the given comparator.
|
(package private) Sorter.DocMap |
sort(int maxDoc,
Sorter.DocComparator[] comparators) |
(package private) Sorter.DocMap |
sort(LeafReader reader)
Returns a mapping from the old document ID to its new location in the
sorted index.
|
java.lang.String |
toString() |
final Sort sort
Sorter(Sort sort)
sortstatic boolean isConsistent(Sorter.DocMap docMap)
Sorter.DocMap, useful for assertions.private static Sorter.DocMap sort(int maxDoc, Sorter.DocComparator comparator)
static SortField.Type getSortFieldType(SortField sortField)
SortedSetSortField and SortedNumericSortField,
SortField.getType() otherwisestatic NumericDocValues getOrWrapNumeric(LeafReader reader, SortField sortField) throws java.io.IOException
SortedNumericDocValues as a single-valued view if the field is an instance of SortedNumericSortField,
returns NumericDocValues for the field otherwise.java.io.IOExceptionstatic SortedDocValues getOrWrapSorted(LeafReader reader, SortField sortField) throws java.io.IOException
SortedSetDocValues as a single-valued view if the field is an instance of SortedSetSortField,
returns SortedDocValues for the field otherwise.java.io.IOExceptionstatic Sorter.DocComparator getDocComparator(LeafReader reader, SortField sortField) throws java.io.IOException
java.io.IOExceptionstatic Sorter.DocComparator getDocComparator(int maxDoc, SortField sortField, Sorter.SortedDocValuesSupplier sortedProvider, Sorter.NumericDocValuesSupplier numericProvider) throws java.io.IOException
FieldComparator API because that API requires that you send it docIDs in order. Note that this API
allocates arrays[maxDoc] to hold the native values needed for comparison, but 1) they are transient (only alive while sorting this one
segment), and 2) in the typical index sorting case, they are only used to sort newly flushed segments, which will be smaller than
merged segments.java.io.IOExceptionSorter.DocMap sort(LeafReader reader) throws java.io.IOException
sort(int, DocComparator) to compute the old-to-new permutation
given a list of documents and their corresponding values.
A return value of null is allowed and means that
reader is already sorted.
NOTE: deleted documents are expected to appear in the mapping as well, they will however be marked as deleted in the sorted view.
java.io.IOExceptionSorter.DocMap sort(int maxDoc, Sorter.DocComparator[] comparators) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getID()
public java.lang.String toString()
toString in class java.lang.Object