org.apache.lucene.search

Class SortField

    • Constructor Detail

      • SortField

        public SortField(String field,
                         SortField.Type type)
        Creates a sort by terms in the given field with the type of term values explicitly given.
        Parameters:
        field - Name of field to sort by. Can be null if type is SCORE or DOC.
        type - Type of values in the terms.
      • SortField

        public SortField(String field,
                         SortField.Type type,
                         boolean reverse)
        Creates a sort, possibly in reverse, by terms in the given field with the type of term values explicitly given.
        Parameters:
        field - Name of field to sort by. Can be null if type is SCORE or DOC.
        type - Type of values in the terms.
        reverse - True if natural order should be reversed.
      • SortField

        public SortField(String field,
                         FieldComparatorSource comparator)
        Creates a sort with a custom comparison function.
        Parameters:
        field - Name of field to sort by; cannot be null.
        comparator - Returns a comparator for sorting hits.
      • SortField

        public SortField(String field,
                         FieldComparatorSource comparator,
                         boolean reverse)
        Creates a sort, possibly in reverse, with a custom comparison function.
        Parameters:
        field - Name of field to sort by; cannot be null.
        comparator - Returns a comparator for sorting hits.
        reverse - True if natural order should be reversed.