Class IndexSorter.BinarySorter
- All Implemented Interfaces:
IndexSorter
- Enclosing interface:
IndexSorter
BinaryDocValues instance, using the given comparator.
Unlike IndexSorter.StringSorter there is no global ordinal map: values are compared directly, so
the merge reads each (already sorted) segment strictly sequentially via DocIdSetIterator.nextDoc(), which stays linear and efficient even for block-compressed formats.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.lucene.index.IndexSorter
IndexSorter.BinaryDocValuesProvider, IndexSorter.BinarySorter, IndexSorter.ComparableProvider, IndexSorter.ComparableValues, IndexSorter.DocComparator, IndexSorter.DoubleSorter, IndexSorter.FloatSorter, IndexSorter.IntSorter, IndexSorter.LongSorter, IndexSorter.NumericDocValuesProvider, IndexSorter.SortedDocValuesProvider, IndexSorter.StringSorter -
Constructor Summary
ConstructorsConstructorDescriptionBinarySorter(String providerName, boolean reverse, Comparator<BytesRef> comparator, IndexSorter.BinaryDocValuesProvider valuesProvider) Creates a new BinarySorter -
Method Summary
Modifier and TypeMethodDescriptiongetComparableValues(List<? extends LeafReader> readers) Get aIndexSorter.ComparableValues, used for merge sorting documents across the given segments.getDocComparator(LeafReader reader, int maxDoc) Get a comparator that determines the sort order of docs within a single Reader.The SPI-registered name of aSortFieldProviderthat will deserialize the parent SortFieldMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.index.IndexSorter
getComparableProviders
-
Constructor Details
-
BinarySorter
public BinarySorter(String providerName, boolean reverse, Comparator<BytesRef> comparator, IndexSorter.BinaryDocValuesProvider valuesProvider) Creates a new BinarySorter
-
-
Method Details
-
getComparableValues
public IndexSorter.ComparableValues getComparableValues(List<? extends LeafReader> readers) throws IOException Description copied from interface:IndexSorterGet aIndexSorter.ComparableValues, used for merge sorting documents across the given segments.The default implementation adapts
IndexSorter.getComparableProviders(List)and is appropriate for any sort whose value can be represented as along.- Specified by:
getComparableValuesin interfaceIndexSorter- Parameters:
readers- the readers to be merged- Throws:
IOException
-
getDocComparator
Description copied from interface:IndexSorterGet a comparator that determines the sort order of docs within a single Reader.NB We cannot simply use the
FieldComparatorAPI because it requires docIDs to be sent in-order. The default implementations allocate array[maxDoc] to hold native values 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- Specified by:
getDocComparatorin interfaceIndexSorter- Parameters:
reader- the Reader to sortmaxDoc- the number of documents in the Reader- Throws:
IOException
-
getProviderName
Description copied from interface:IndexSorterThe SPI-registered name of aSortFieldProviderthat will deserialize the parent SortField- Specified by:
getProviderNamein interfaceIndexSorter
-