## org.apache.lucene.index.sorter
Class SortingAtomicReader

    java.lang.Object
      org.apache.lucene.index.IndexReader
          org.apache.lucene.index.AtomicReader
              org.apache.lucene.index.FilterAtomicReader
                  org.apache.lucene.index.sorter.SortingAtomicReader

All Implemented Interfaces:
  Closeable

    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 = new SortingAtomicReader(reader, sorter);
     writer.addIndexes(reader);
     writer.close();
     reader.close();

WARNING: This API is experimental and might change in incompatible ways in the next release.

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.lucene.index.FilterAtomicReader
`FilterAtomicReader.FilterDocsAndPositionsEnum, FilterAtomicReader.FilterDocsEnum, FilterAtomicReader.FilterFields, FilterAtomicReader.FilterTerms, FilterAtomicReader.FilterTermsEnum`

Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
`IndexReader.ReaderClosedListener`

Field Summary

Fields inherited from class org.apache.lucene.index.FilterAtomicReader
`in`

Method Summary
`void` `document(int docID, StoredFieldVisitor visitor)`
`Fields` `fields()`
`BinaryDocValues` `getBinaryDocValues(String field)`
`Bits` `getLiveDocs()`
`NumericDocValues` `getNormValues(String field)`
`NumericDocValues` `getNumericDocValues(String field)`
`SortedDocValues` `getSortedDocValues(String field)`
`SortedSetDocValues` `getSortedSetDocValues(String field)`
`Fields` `getTermVectors(int docID)`
`static AtomicReader` `wrap(AtomicReader reader, Sorter.DocMap docMap)` Expert: same as `wrap(AtomicReader, Sorter)` but operates directly on a `Sorter.DocMap`.
`static AtomicReader` `wrap(AtomicReader reader, Sorter sorter)` Return a sorted view of `reader` according to the order defined by `sorter`.

Methods inherited from class org.apache.lucene.index.FilterAtomicReader
`doClose, getFieldInfos, maxDoc, numDocs, toString`

Methods inherited from class org.apache.lucene.index.AtomicReader
`docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, hasNorms, termDocsEnum, termPositionsEnum, terms, totalTermFreq`

Methods inherited from class org.apache.lucene.index.IndexReader
`addReaderClosedListener, close, decRef, document, document, ensureOpen, equals, getCombinedCoreAndDeletesKey, getCoreCacheKey, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, open, open, open, open, open, registerParentReader, removeReaderClosedListener, tryIncRef`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Method Detail

### wrap

    public static AtomicReader wrap(AtomicReader reader,
                                    Sorter sorter)
                             throws IOException

  Return a sorted view of `reader` according to the order defined by `sorter`. If the reader is already sorted, this method might return the reader as-is.

  Throws:
    `IOException`

### wrap

    public static AtomicReader wrap(AtomicReader reader,
                                    Sorter.DocMap docMap)

  Expert: same as `wrap(AtomicReader, Sorter)` but operates directly on a `Sorter.DocMap`.

### document

    public void document(int docID,
                         StoredFieldVisitor visitor)
                  throws IOException

  Overrides:
    `document` in class `FilterAtomicReader`
  Throws:
    `IOException`

### fields

    public Fields fields()
                  throws IOException

  Overrides:
    `fields` in class `FilterAtomicReader`
  Throws:
    `IOException`

### getBinaryDocValues

    public BinaryDocValues getBinaryDocValues(String field)
                                       throws IOException

  Overrides:
    `getBinaryDocValues` in class `FilterAtomicReader`
  Throws:
    `IOException`

### getLiveDocs

    public Bits getLiveDocs()

  Overrides:
    `getLiveDocs` in class `FilterAtomicReader`

### getNormValues

    public NumericDocValues getNormValues(String field)
                                   throws IOException

  Overrides:
    `getNormValues` in class `FilterAtomicReader`
  Throws:
    `IOException`

### getNumericDocValues

    public NumericDocValues getNumericDocValues(String field)
                                         throws IOException

  Overrides:
    `getNumericDocValues` in class `FilterAtomicReader`
  Throws:
    `IOException`

### getSortedDocValues

    public SortedDocValues getSortedDocValues(String field)
                                       throws IOException

  Overrides:
    `getSortedDocValues` in class `FilterAtomicReader`
  Throws:
    `IOException`

### getSortedSetDocValues

    public SortedSetDocValues getSortedSetDocValues(String field)
                                             throws IOException

  Overrides:
    `getSortedSetDocValues` in class `FilterAtomicReader`
  Throws:
    `IOException`

### getTermVectors

    public Fields getTermVectors(int docID)
                          throws IOException

  Overrides:
    `getTermVectors` in class `FilterAtomicReader`
  Throws:
    `IOException`

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