use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class AccessUniqueDatabaseIndexTest method shouldAddUniqueEntries.
@Test
void shouldAddUniqueEntries() throws Exception {
// given
PartitionedIndexStorage indexStorage = getIndexStorage();
LuceneIndexAccessor accessor = createAccessor(indexStorage);
// when
updateAndCommit(accessor, asList(add(1L, "value1"), add(2L, "value2")));
updateAndCommit(accessor, singletonList(add(3L, "value3")));
accessor.close();
// then
assertEquals(singletonList(1L), getAllNodes(indexStorage, "value1"));
}
use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class AccessUniqueDatabaseIndexTest method shouldRemoveAndAddEntries.
@Test
void shouldRemoveAndAddEntries() throws Exception {
// given
PartitionedIndexStorage indexStorage = getIndexStorage();
LuceneIndexAccessor accessor = createAccessor(indexStorage);
// when
updateAndCommit(accessor, singletonList(add(1L, "value1")));
updateAndCommit(accessor, singletonList(add(2L, "value2")));
updateAndCommit(accessor, singletonList(add(3L, "value3")));
updateAndCommit(accessor, singletonList(add(4L, "value4")));
updateAndCommit(accessor, singletonList(remove(1L, "value1")));
updateAndCommit(accessor, singletonList(remove(2L, "value2")));
updateAndCommit(accessor, singletonList(remove(3L, "value3")));
updateAndCommit(accessor, singletonList(add(1L, "value1")));
updateAndCommit(accessor, singletonList(add(3L, "value3b")));
accessor.close();
// then
assertEquals(singletonList(1L), getAllNodes(indexStorage, "value1"));
assertEquals(emptyList(), getAllNodes(indexStorage, "value2"));
assertEquals(emptyList(), getAllNodes(indexStorage, "value3"));
assertEquals(singletonList(3L), getAllNodes(indexStorage, "value3b"));
assertEquals(singletonList(4L), getAllNodes(indexStorage, "value4"));
}
use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class UniqueDatabaseIndexPopulatorTest method setUp.
@BeforeEach
void setUp() {
Path folder = testDir.directory("folder");
indexStorage = new PartitionedIndexStorage(directoryFactory, fs, folder);
index = LuceneSchemaIndexBuilder.create(descriptor, writable(), Config.defaults()).withIndexStorage(indexStorage).build();
schemaDescriptor = descriptor.schema();
}
use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class FulltextIndexProvider method getOnlineAccessor.
@Override
public IndexAccessor getOnlineAccessor(IndexDescriptor index, IndexSamplingConfig samplingConfig, TokenNameLookup tokenNameLookup) throws IOException {
PartitionedIndexStorage indexStorage = getIndexStorage(index.getId());
Analyzer analyzer = createAnalyzer(index, tokenHolders);
String[] propertyNames = createPropertyNames(index, tokenHolders);
FulltextIndexBuilder fulltextIndexBuilder = FulltextIndexBuilder.create(index, config, readOnlyChecker, tokenHolders.propertyKeyTokens(), analyzer, propertyNames).withFileSystem(fileSystem).withIndexStorage(indexStorage).withPopulatingMode(false);
if (isEventuallyConsistent(index)) {
fulltextIndexBuilder = fulltextIndexBuilder.withIndexUpdateSink(indexUpdateSink);
}
DatabaseIndex<FulltextIndexReader> fulltextIndex = fulltextIndexBuilder.build();
fulltextIndex.open();
FulltextIndexAccessor accessor = new FulltextIndexAccessor(indexUpdateSink, fulltextIndex, index, propertyNames);
log.debug("Created online accessor for fulltext schema index %s: %s", index, accessor);
return accessor;
}
use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class FulltextIndexProvider method getMinimalIndexAccessor.
@Override
public MinimalIndexAccessor getMinimalIndexAccessor(IndexDescriptor descriptor) {
PartitionedIndexStorage indexStorage = getIndexStorage(descriptor.getId());
DatabaseIndex<FulltextIndexReader> fulltextIndex = new DroppableIndex<>(new DroppableLuceneIndex<>(indexStorage, new ReadOnlyIndexPartitionFactory(), descriptor));
log.debug("Creating dropper for fulltext schema index: %s", descriptor);
return new LuceneMinimalIndexAccessor<>(descriptor, fulltextIndex, isReadOnly());
}
Aggregations