use of org.neo4j.kernel.api.impl.index.DatabaseIndex in project neo4j by neo4j.
the class FulltextIndexProvider method getPopulator.
@Override
public IndexPopulator getPopulator(IndexDescriptor descriptor, IndexSamplingConfig samplingConfig, ByteBufferFactory bufferFactory, MemoryTracker memoryTracker, TokenNameLookup tokenNameLookup) {
if (isReadOnly()) {
throw new UnsupportedOperationException("Can't create populator for read only index");
}
try {
PartitionedIndexStorage indexStorage = getIndexStorage(descriptor.getId());
Analyzer analyzer = createAnalyzer(descriptor, tokenNameLookup);
String[] propertyNames = createPropertyNames(descriptor, tokenNameLookup);
DatabaseIndex<FulltextIndexReader> fulltextIndex = FulltextIndexBuilder.create(descriptor, config, readOnlyChecker, tokenHolders.propertyKeyTokens(), analyzer, propertyNames).withFileSystem(fileSystem).withIndexStorage(indexStorage).withPopulatingMode(true).build();
log.debug("Creating populator for fulltext schema index: %s", descriptor);
return new FulltextIndexPopulator(descriptor, fulltextIndex, propertyNames);
} catch (Exception e) {
PartitionedIndexStorage indexStorage = getIndexStorage(descriptor.getId());
DatabaseIndex<FulltextIndexReader> fulltextIndex = new DroppableIndex<>(new DroppableLuceneIndex<>(indexStorage, new ReadOnlyIndexPartitionFactory(), descriptor));
log.debug("Creating failed index populator for fulltext schema index: %s", descriptor, e);
return new FailedFulltextIndexPopulator(descriptor, fulltextIndex, e);
}
}
Aggregations