|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.index.sorter.Sorter
public abstract class Sorter
Sorts documents of a given index by returning a permutation on the document IDs.
NOTE: A Sorter
implementation can be easily written from
a document comparator
by using the
sort(int, DocComparator)
helper method. This is especially useful
when documents are directly comparable by their field values.
Nested Class Summary | |
---|---|
static class |
Sorter.DocComparator
A comparator of doc IDs. |
static class |
Sorter.DocMap
A permutation of doc IDs. |
Field Summary | |
---|---|
static Sorter.DocComparator |
INDEX_ORDER_COMPARATOR
A comparator that keeps documents in index order. |
static Sorter |
REVERSE_DOCS
Sorts documents in reverse order. |
Constructor Summary | |
---|---|
Sorter()
|
Method Summary | |
---|---|
abstract String |
getID()
Returns the identifier of this Sorter . |
abstract Sorter.DocMap |
sort(AtomicReader reader)
Returns a mapping from the old document ID to its new location in the sorted index. |
protected static Sorter.DocMap |
sort(int maxDoc,
Sorter.DocComparator comparator)
Computes the old-to-new permutation over the given comparator. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Sorter.DocComparator INDEX_ORDER_COMPARATOR
public static final Sorter REVERSE_DOCS
Sorter
is not
idempotent. Sorting an AtomicReader
once or twice will return two
different AtomicReader
views. This Sorter
should not be
used with SortingMergePolicy
.
Constructor Detail |
---|
public Sorter()
Method Detail |
---|
protected static Sorter.DocMap sort(int maxDoc, Sorter.DocComparator comparator)
public abstract Sorter.DocMap sort(AtomicReader reader) throws IOException
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.
IOException
public abstract String getID()
Sorter
.
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 different sorters
.
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |