use of org.elasticsearch.index.similarity.SimilarityLookupService in project elasticsearch-opennlp-plugin by spinscale.
the class OpenNlpMappingTest method setupMapperParser.
@Before
public void setupMapperParser() {
Index index = new Index("test");
Map<String, AnalyzerProviderFactory> analyzerFactoryFactories = Maps.newHashMap();
analyzerFactoryFactories.put("keyword", new PreBuiltAnalyzerProviderFactory("keyword", AnalyzerScope.INDEX, new KeywordAnalyzer()));
AnalysisService analysisService = new AnalysisService(index, ImmutableSettings.Builder.EMPTY_SETTINGS, null, analyzerFactoryFactories, null, null, null);
mapperParser = new DocumentMapperParser(index, analysisService, new PostingsFormatService(index), new SimilarityLookupService(index, ImmutableSettings.Builder.EMPTY_SETTINGS));
Settings settings = settingsBuilder().put("opennlp.models.name.file", "src/test/resources/models/en-ner-person.bin").put("opennlp.models.date.file", "src/test/resources/models/en-ner-date.bin").put("opennlp.models.location.file", "src/test/resources/models/en-ner-location.bin").build();
LogConfigurator.configure(settings);
OpenNlpService openNlpService = new OpenNlpService(settings);
openNlpService.start();
mapperParser.putTypeParser(OpenNlpMapper.CONTENT_TYPE, new OpenNlpMapper.TypeParser(analysisService, openNlpService));
}
use of org.elasticsearch.index.similarity.SimilarityLookupService in project crate by crate.
the class LuceneQueryBuilderTest method createMapperService.
private MapperService createMapperService(Index index, Settings indexSettings, AnalysisService analysisService) {
DynamicArrayFieldMapperBuilderFactoryProvider arrayMapperProvider = new DynamicArrayFieldMapperBuilderFactoryProvider();
arrayMapperProvider.dynamicArrayFieldMapperBuilderFactory = new ArrayMapper.BuilderFactory();
IndicesModule indicesModule = new IndicesModule();
indicesModule.registerMapper(ArrayMapper.CONTENT_TYPE, new ArrayMapper.TypeParser());
return new MapperService(index, indexSettings, analysisService, new SimilarityLookupService(index, indexSettings), null, indicesModule.getMapperRegistry(), arrayMapperProvider);
}
Aggregations