TextMapper extends SingleColumnMapper.SingleFieldMapper<String> { @Override public Optional<Field> indexedField(String name, String value) { return Optional.of(new TextField(name, value, STORE)); } TextMapper(String field, String column, Boolean validated, String analyzer); @Override Optional<Field> indexedField(String name, String value); @Override Optional<Field> sortedField(String name, String value); @Override SortField sortField(String name, boolean reverse); @Override String toString();  }
@Test public void testIndexedField() { TextMapper mapper = textMapper().analyzer("org.apache.lucene.analysis.en.EnglishAnalyzer").build("field"); Field field = mapper.indexedField("name", "hello") .orElseThrow(() -> new AssertionError("Indexed field is not created")); assertEquals("Indexed field name is wrong", "name", field.name()); assertEquals("Indexed field value is wrong", "hello", field.stringValue()); assertFalse("Indexed field type is wrong", field.fieldType().stored()); }