use of org.apache.geode.cache.lucene.internal.LuceneRawIndexFactory in project geode by apache.
the class LuceneIndexCreationIntegrationTest method shouldCreateRawIndexIfSpecifiedItsFactory.
@Test
public void shouldCreateRawIndexIfSpecifiedItsFactory() throws BucketNotFoundException, InterruptedException {
Map<String, Analyzer> analyzers = new HashMap<>();
final RecordingAnalyzer field1Analyzer = new RecordingAnalyzer();
final RecordingAnalyzer field2Analyzer = new RecordingAnalyzer();
analyzers.put("field1", field1Analyzer);
analyzers.put("field2", field2Analyzer);
LuceneServiceImpl.luceneIndexFactory = new LuceneRawIndexFactory();
try {
luceneService.createIndexFactory().setFields(analyzers).create(INDEX_NAME, REGION_NAME);
Region region = createRegion();
final LuceneIndex index = luceneService.getIndex(INDEX_NAME, REGION_NAME);
assertThat(index).isInstanceOf(LuceneRawIndex.class);
region.put("key1", new TestObject());
verifyIndexFinishFlushing(cache, INDEX_NAME, REGION_NAME);
assertEquals(analyzers, index.getFieldAnalyzers());
assertEquals(Arrays.asList("field1"), field1Analyzer.analyzedfields);
assertEquals(Arrays.asList("field2"), field2Analyzer.analyzedfields);
} finally {
LuceneServiceImpl.luceneIndexFactory = new LuceneIndexImplFactory();
}
}
Aggregations