use of org.neo4j.internal.kernel.api.RelationshipValueIndexCursor in project neo4j by neo4j.
the class ManagedTestCursors method allocateRelationshipValueIndexCursor.
@Override
public RelationshipValueIndexCursor allocateRelationshipValueIndexCursor(CursorContext cursorContext, MemoryTracker memoryTracker) {
RelationshipValueIndexCursor n = cursors.allocateRelationshipValueIndexCursor(cursorContext, memoryTracker);
allCursors.add(n);
return n;
}
use of org.neo4j.internal.kernel.api.RelationshipValueIndexCursor in project neo4j by neo4j.
the class FulltextIndexProviderTest method verifyRelationshipData.
private void verifyRelationshipData(long secondRelId) throws Exception {
try (Transaction tx = db.beginTx()) {
KernelTransaction ktx = LuceneFulltextTestSupport.kernelTransaction(tx);
IndexDescriptor index = ktx.schemaRead().indexGetForName("fulltext");
IndexReadSession indexReadSession = ktx.dataRead().indexReadSession(index);
try (RelationshipValueIndexCursor cursor = ktx.cursors().allocateRelationshipValueIndexCursor(ktx.cursorContext(), ktx.memoryTracker())) {
ktx.dataRead().relationshipIndexSeek(indexReadSession, cursor, unconstrained(), fulltextSearch("valuuu"));
assertTrue(cursor.next());
assertEquals(0L, cursor.relationshipReference());
assertFalse(cursor.next());
ktx.dataRead().relationshipIndexSeek(indexReadSession, cursor, unconstrained(), fulltextSearch("villa"));
assertTrue(cursor.next());
assertEquals(secondRelId, cursor.relationshipReference());
assertFalse(cursor.next());
ktx.dataRead().relationshipIndexSeek(indexReadSession, cursor, unconstrained(), fulltextSearch("value3"));
assertTrue(cursor.next());
assertEquals(0L, cursor.relationshipReference());
assertTrue(cursor.next());
assertEquals(secondRelId, cursor.relationshipReference());
assertFalse(cursor.next());
}
tx.commit();
}
}
use of org.neo4j.internal.kernel.api.RelationshipValueIndexCursor in project neo4j by neo4j.
the class RelationshipTypeIndexIT method countRelationshipsInFulltextIndex.
private int countRelationshipsInFulltextIndex(String indexName) throws KernelException {
int relationshipsInIndex;
try (Transaction transaction = db.beginTx()) {
KernelTransaction ktx = ((InternalTransaction) transaction).kernelTransaction();
IndexDescriptor index = ktx.schemaRead().indexGetForName(indexName);
IndexReadSession indexReadSession = ktx.dataRead().indexReadSession(index);
relationshipsInIndex = 0;
try (RelationshipValueIndexCursor cursor = ktx.cursors().allocateRelationshipValueIndexCursor(ktx.cursorContext(), ktx.memoryTracker())) {
ktx.dataRead().relationshipIndexSeek(indexReadSession, cursor, unconstrained(), fulltextSearch("*"));
while (cursor.next()) {
relationshipsInIndex++;
}
}
}
return relationshipsInIndex;
}
Aggregations