Schema implements Closeable { @Override public void close() { analyzer.close(); } Schema(Analyzer defaultAnalyzer, Map<String, Mapper> mappers, Map<String, Analyzer> analyzers); Analyzer analyzer(String fieldName); Mapper mapper(String field); Set<String> mappedCells(); void validate(Columns columns); List<IndexableField> indexableFields(Columns columns); List<IndexableField> postProcessingIndexableFields(Columns columns, Search search); boolean mapsCell(String cell); @Override void close(); @Override String toString(); final Map<String, Mapper> mappers; final SchemaAnalyzer analyzer; final Analyzer defaultAnalyzer; }
@Test public void testGetDefaultAnalyzer() { Map<String, Mapper> mappers = new HashMap<>(); Map<String, Analyzer> analyzers = new HashMap<>(); Schema schema = new Schema(new EnglishAnalyzer(), mappers, analyzers); Analyzer analyzer = schema.defaultAnalyzer; assertEquals("Expected english analyzer", EnglishAnalyzer.class, analyzer.getClass()); schema.close(); }
@Test public void testGetDefaultAnalyzerNotSpecified() { Map<String, Mapper> mappers = new HashMap<>(); Map<String, Analyzer> analyzers = new HashMap<>(); Schema schema = new Schema(new EnglishAnalyzer(), mappers, analyzers); Analyzer analyzer = schema.defaultAnalyzer; assertEquals("Expected default analyzer", EnglishAnalyzer.class, analyzer.getClass()); schema.close(); }