use of org.neo4j.internal.kernel.api.CursorFactory in project neo4j by neo4j.
the class FulltextIndexTransactionState method updateSearcher.
private void updateSearcher(QueryContext context, CursorContext cursorContext, MemoryTracker memoryTracker) throws Exception {
Read read = context.getRead();
CursorFactory cursors = context.cursors();
ReadableTransactionState state = context.getTransactionStateOrNull();
// Clear this, so we don't filter out entities who have had their changes reversed since last time.
modifiedEntityIdsInThisTransaction.clear();
writer.resetWriterState();
try (NodeCursor nodeCursor = visitingNodes ? cursors.allocateFullAccessNodeCursor(cursorContext) : null;
RelationshipScanCursor relationshipCursor = visitingNodes ? null : cursors.allocateRelationshipScanCursor(cursorContext);
PropertyCursor propertyCursor = cursors.allocateFullAccessPropertyCursor(cursorContext, memoryTracker)) {
state.accept(txStateVisitor.init(read, nodeCursor, relationshipCursor, propertyCursor));
}
currentSearcher = writer.getNearRealTimeSearcher();
toCloseLater.add(currentSearcher);
lastUpdateRevision = state.getDataRevision();
}
use of org.neo4j.internal.kernel.api.CursorFactory in project neo4j by neo4j.
the class CachingExpandIntoTest method shouldComputeDegreeWithoutType.
@Test
void shouldComputeDegreeWithoutType() throws Exception {
// GIVEN
long node;
try (KernelTransaction tx = transaction()) {
Write write = tx.dataWrite();
node = nodeWithDegree(tx, 42);
relate(tx, node, "R1", write.nodeCreate());
relate(tx, node, "R2", write.nodeCreate());
relate(tx, write.nodeCreate(), "R3", node);
relate(tx, node, "R4", node);
tx.commit();
}
try (KernelTransaction tx = transaction()) {
Read read = tx.dataRead();
CursorFactory cursors = tx.cursors();
try (NodeCursor nodes = cursors.allocateNodeCursor(tx.cursorContext())) {
CachingExpandInto expand = new CachingExpandInto(tx.dataRead(), OUTGOING, MEMORY_TRACKER);
read.singleNode(node, nodes);
assertThat(nodes.next()).isEqualTo(true);
assertThat(nodes.supportsFastDegreeLookup()).isEqualTo(true);
Degrees degrees = nodes.degrees(ALL_RELATIONSHIPS);
assertThat(degrees.outgoingDegree()).isEqualTo(45);
assertThat(degrees.incomingDegree()).isEqualTo(2);
assertThat(degrees.totalDegree()).isEqualTo(46);
}
}
}
Aggregations