## Package org.apache.lucene.index.sorter

Provides index sorting capablities.

See:
Description

Class Summary
EarlyTerminatingSortingCollector: A `Collector` that early terminates collection of documents on a per-segment basis, if the segment was sorted according to the given `Sorter`.
NumericDocValuesSorter: A `Sorter` which sorts documents according to their `NumericDocValues`.
Sorter: Sorts documents of a given index by returning a permutation on the document IDs.
Sorter.DocComparator: A comparator of doc IDs.
Sorter.DocMap: A permutation of doc IDs.
SortingAtomicReader: An `AtomicReader` which supports sorting documents by a given `Sorter`.
SortingMergePolicy: A `MergePolicy` that reorders documents according to a `Sorter` before merging them.

## Package org.apache.lucene.index.sorter Description

Provides index sorting capablities. The application can use one of the pre-existing Sorter implementations, e.g. to sort by a `NumericDocValuesSorter` or `reverse` the order of the documents. Additionally, the application can implement a custom `Sorter` which returns a permutation on a source `AtomicReader`'s document IDs, to sort the input documents by additional criteria.

`SortingMergePolicy` can be used to make Lucene sort segments before merging them. This will ensure that every segment resulting from a merge will be sorted according to the provided `Sorter`. This however makes merging and thus indexing slower.

Sorted segments allow for early query termination when the sort order matches index order. This makes query execution faster since not all documents need to be visited. Please note that this is an expert feature and should not be used without a deep understanding of Lucene merging and document collection.

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.