IntegerMapper extends SingleColumnMapper.SingleFieldMapper<Integer> { @Override public Optional<Field> sortedField(String name, Integer value) { return Optional.of(new SortedNumericDocValuesField(name, value)); } IntegerMapper(String field, String column, Boolean validated, Float boost); @Override Optional<Field> indexedField(String name, Integer value); @Override Optional<Field> sortedField(String name, Integer value); @Override SortField sortField(String name, boolean reverse); @Override String toString(); static final Float DEFAULT_BOOST; final Float boost; }
@Test public void testSortedField() { IntegerMapper mapper = integerMapper().boost(1f).build("field"); Field field = mapper.sortedField("name", 3) .orElseThrow(() -> new AssertionError("Sorted field is not created")); assertEquals("Sorted field type is wrong", DocValuesType.SORTED_NUMERIC, field.fieldType().docValuesType()); }