Package org.apache.lucene.index
Class Sorter
- java.lang.Object
-
- org.apache.lucene.index.Sorter
-
final class Sorter extends java.lang.Object
Sorts 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 class
Sorter.DocMap
A permutation of doc IDs.private static class
Sorter.DocValueSorter
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getID()
Returns the identifier of thisSorter
.(package private) static boolean
isConsistent(Sorter.DocMap docMap)
Check consistency of aSorter.DocMap
, useful for assertions.private static Sorter.DocMap
sort(int maxDoc, IndexSorter.DocComparator comparator)
Computes the old-to-new permutation over the given comparator.(package private) Sorter.DocMap
sort(int maxDoc, IndexSorter.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()
-
-
-
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
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.
- 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:
toString
in classjava.lang.Object
-
-