Class Sorter

    • Field Detail

      • INDEX_ORDER_COMPARATOR

        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 java.io.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.

        Throws:
        java.io.IOException
      • getID

        public abstract java.lang.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.

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object