Class Sorter

    • Field Detail


        public static final Sorter.DocComparator INDEX_ORDER_COMPARATOR
        A comparator that keeps documents in index order.
    • Constructor Detail

      • Sorter

        public Sorter()
    • Method Detail

      • sort

        public abstract Sorter.DocMap sort​(AtomicReader reader)
                                    throws IOException
        Returns a mapping from the old document ID to its new location in the sorted index. Implementations can use the auxiliary 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.

      • getID

        public abstract String getID()
        Returns the identifier of this 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.