Class SortedNumericSortField


  • public class SortedNumericSortField
    extends SortField
    SortField for SortedNumericDocValues.

    A SortedNumericDocValues contains multiple values for a field, so sorting with this technique "selects" a value as the representative sort value for the document.

    By default, the minimum value in the list is selected as the sort value, but this can be customized.

    Like sorting by string, this also supports sorting missing values as first or last, via setMissingValue(Object).

    See Also:
    SortedNumericSelector
    • Constructor Detail

      • SortedNumericSortField

        public SortedNumericSortField​(String field,
                                      SortField.Type type)
        Creates a sort, by the minimum value in the set for the document.
        Parameters:
        field - Name of field to sort by. Must not be null.
        type - Type of values
      • SortedNumericSortField

        public SortedNumericSortField​(String field,
                                      SortField.Type type,
                                      boolean reverse)
        Creates a sort, possibly in reverse, by the minimum value in the set for the document.
        Parameters:
        field - Name of field to sort by. Must not be null.
        type - Type of values
        reverse - True if natural order should be reversed.
      • SortedNumericSortField

        public SortedNumericSortField​(String field,
                                      SortField.Type type,
                                      boolean reverse,
                                      SortedNumericSelector.Type selector)
        Creates a sort, possibly in reverse, specifying how the sort value from the document's set is selected.
        Parameters:
        field - Name of field to sort by. Must not be null.
        type - Type of values
        reverse - True if natural order should be reversed.
        selector - custom selector type for choosing the sort value from the set.