Package org.apache.lucene.index
Class Sorter
- java.lang.Object
-
- org.apache.lucene.index.Sorter
-
final class Sorter extends java.lang.ObjectSorts documents of a given index by returning a permutation on the document IDs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSorter.DocMapA permutation of doc IDs.private static classSorter.DocValueSorter
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetID()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.java.lang.StringtoString()
-
-
-
Field Detail
-
sort
final Sort sort
-
-
Constructor Detail
-
Sorter
Sorter(Sort sort)
Creates a new Sorter to sort the index withsort
-
-
Method Detail
-
isConsistent
static boolean isConsistent(Sorter.DocMap docMap)
Check consistency of aSorter.DocMap, useful for assertions.
-
sort
private static Sorter.DocMap sort(int maxDoc, IndexSorter.DocComparator comparator)
Computes the old-to-new permutation over the given comparator.
-
sort
Sorter.DocMap sort(LeafReader reader) throws java.io.IOException
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 null is allowed and means that
readeris 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:
java.io.IOException
-
sort
Sorter.DocMap sort(int maxDoc, IndexSorter.DocComparator[] comparators) throws java.io.IOException
- Throws:
java.io.IOException
-
getID
public java.lang.String getID()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-