Class SortingAtomicReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class SortingAtomicReader
    extends FilterAtomicReader
    An AtomicReader which supports sorting documents by a given Sorter. You can use this class to sort an index as follows:
     IndexWriter writer; // writer to which the sorted index will be added
     DirectoryReader reader; // reader on the input index
     Sorter sorter; // determines how the documents are sorted
     AtomicReader sortingReader = SortingAtomicReader.wrap(SlowCompositeReaderWrapper.wrap(reader), sorter);