java.lang.Object
org.apache.lucene.index.Sorter
Sorts documents of a given index by returning a permutation on the document IDs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA permutation of doc IDs.private static final class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetID()Returns the identifier of thisSorter.(package private) static booleanisConsistent(Sorter.DocMap docMap) Check consistency of aSorter.DocMap, useful for assertions.private static Sorter.DocMapsort(int maxDoc, IndexSorter.DocComparator comparator) Computes the old-to-new permutation over the given comparator.(package private) Sorter.DocMapsort(int maxDoc, IndexSorter.DocComparator[] comparators) (package private) Sorter.DocMapsort(LeafReader reader) Returns a mapping from the old document ID to its new location in the sorted index.toString()
-
Field Details
-
sort
-
-
Constructor Details
-
Sorter
Sorter(Sort sort) Creates a new Sorter to sort the index withsort
-
-
Method Details
-
isConsistent
Check consistency of aSorter.DocMap, useful for assertions. -
sort
Computes the old-to-new permutation over the given comparator. -
sort
Returns a mapping from the old document ID to its new location in the sorted index. Implementations can use the auxiliarysort(int, IndexSorter.DocComparator)to compute the old-to-new permutation given a list of documents and their corresponding values.A return value of
nullis allowed and means thatreaderis 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.
- Throws:
IOException
-
sort
- Throws:
IOException
-
getID
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 differentsorts. -
toString
-