Package org.apache.lucene.index.sorter
Class NumericDocValuesSorter
- java.lang.Object
-
- org.apache.lucene.index.sorter.Sorter
-
- org.apache.lucene.index.sorter.NumericDocValuesSorter
-
public class NumericDocValuesSorter extends Sorter
ASorter
which sorts documents according to theirNumericDocValues
. One can specify ascending or descending sort order.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.index.sorter.Sorter
Sorter.DocComparator, Sorter.DocMap
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.index.sorter.Sorter
INDEX_ORDER_COMPARATOR, REVERSE_DOCS
-
-
Constructor Summary
Constructors Constructor Description NumericDocValuesSorter(String fieldName)
Constructor over the given field name, and ascending sort order.NumericDocValuesSorter(String fieldName, boolean ascending)
Constructor over the given field name, and whether sorting should be ascending (true
) or descending (false
).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getID()
Returns the identifier of thisSorter
.Sorter.DocMap
sort(AtomicReader reader)
Returns a mapping from the old document ID to its new location in the sorted index.
-
-
-
Constructor Detail
-
NumericDocValuesSorter
public NumericDocValuesSorter(String fieldName)
Constructor over the given field name, and ascending sort order.
-
NumericDocValuesSorter
public NumericDocValuesSorter(String fieldName, boolean ascending)
Constructor over the given field name, and whether sorting should be ascending (true
) or descending (false
).
-
-
Method Detail
-
sort
public Sorter.DocMap sort(AtomicReader reader) throws IOException
Description copied from class:Sorter
Returns a mapping from the old document ID to its new location in the sorted index. Implementations can use the auxiliarySorter.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.
- Specified by:
sort
in classSorter
- Throws:
IOException
-
getID
public String getID()
Description copied from class:Sorter
Returns the identifier of thisSorter
.This identifier is similar to
Object.hashCode()
and should be chosen so that two instances of this class that sort documents likewise will have the same identifier. On the contrary, this identifier should be different on differentsorters
.
-
-