Class SortedNumericDocValuesField

  • All Implemented Interfaces:
    IndexableField

    public class SortedNumericDocValuesField
    extends Field
    Field that stores a per-document long values for scoring, sorting or value retrieval. Here's an example usage:
       document.add(new SortedNumericDocValuesField(name, 5L));
       document.add(new SortedNumericDocValuesField(name, 14L));
     

    Note that if you want to encode doubles or floats with proper sort order, you will need to encode them with NumericUtils:

       document.add(new SortedNumericDocValuesField(name, NumericUtils.floatToSortableInt(-5.3f)));
     

    If you also need to store the value, you should add a separate StoredField instance.