use of org.neo4j.storageengine.api.schema.IndexReader in project neo4j by neo4j.
the class SimpleIndexReaderTest method releaseSearcherOnClose.
@Test
public void releaseSearcherOnClose() throws IOException {
IndexReader simpleIndexReader = getUniqueSimpleReader();
simpleIndexReader.close();
verify(partitionSearcher).close();
}
use of org.neo4j.storageengine.api.schema.IndexReader in project neo4j by neo4j.
the class SimpleIndexReaderTest method seekQueryReachSearcher.
@Test
public void seekQueryReachSearcher() throws Exception {
IndexReader simpleIndexReader = getUniqueSimpleReader();
simpleIndexReader.query(IndexQuery.exact(1, "test"));
verify(indexSearcher).search(any(TermQuery.class), any(DocValuesCollector.class));
}
use of org.neo4j.storageengine.api.schema.IndexReader in project neo4j by neo4j.
the class SimpleIndexReaderTest method countIndexedNodesReachSearcher.
@Test
public void countIndexedNodesReachSearcher() throws IOException {
IndexReader simpleIndexReader = getUniqueSimpleReader();
simpleIndexReader.countIndexedNodes(2, "testValue");
verify(indexSearcher).search(any(BooleanQuery.class), any(DocValuesCollector.class));
}
use of org.neo4j.storageengine.api.schema.IndexReader in project neo4j by neo4j.
the class NonUniqueDatabaseIndexPopulatorTest method addUpdates.
@Test
public void addUpdates() throws Exception {
populator = newPopulator();
List<IndexEntryUpdate> updates = Arrays.asList(IndexEntryUpdate.add(1, labelSchemaDescriptor, "foo"), IndexEntryUpdate.add(2, labelSchemaDescriptor, "bar"), IndexEntryUpdate.add(42, labelSchemaDescriptor, "bar"));
populator.add(updates);
index.maybeRefreshBlocking();
try (IndexReader reader = index.getIndexReader()) {
int propertyKeyId = labelSchemaDescriptor.getPropertyId();
PrimitiveLongIterator allEntities = reader.query(IndexQuery.exists(propertyKeyId));
assertArrayEquals(new long[] { 1, 2, 42 }, PrimitiveLongCollections.asArray(allEntities));
}
}
use of org.neo4j.storageengine.api.schema.IndexReader in project neo4j by neo4j.
the class MultiIndexPopulationConcurrentUpdatesIT method applyConcurrentDeletesToPopulatedIndex.
@Test
public void applyConcurrentDeletesToPopulatedIndex() throws Throwable {
List<NodeUpdates> updates = new ArrayList<>(2);
updates.add(NodeUpdates.forNode(0, id(COUNTRY_LABEL)).removed(propertyId, "Sweden").build());
updates.add(NodeUpdates.forNode(3, id(COLOR_LABEL)).removed(propertyId, "green").build());
launchCustomIndexPopulation(labelsNameIdMap, propertyId, updates);
waitAndActivateIndexes(labelsNameIdMap, propertyId);
try (Transaction ignored = embeddedDatabase.beginTx()) {
Integer countryLabelId = labelsNameIdMap.get(COUNTRY_LABEL);
Integer colorLabelId = labelsNameIdMap.get(COLOR_LABEL);
try (IndexReader indexReader = getIndexReader(propertyId, countryLabelId)) {
assertEquals("Should be removed by concurrent remove.", 0, indexReader.countIndexedNodes(0, "Sweden"));
}
try (IndexReader indexReader = getIndexReader(propertyId, colorLabelId)) {
assertEquals("Should be removed by concurrent remove.", 0, indexReader.countIndexedNodes(3, "green"));
}
}
}
Aggregations