After I added after
trigger some of my subsequent queries just freeze and lock me, so I can not do any other CREATE
. MATCH
to see existing nodes just works fine and are successfuly created. I use Neo4j in version 3.5.16 enterprise
My trigger:
CALL apoc.trigger.add(
'location_node_after',
'UNWIND {createdNodes} AS node WITH node WHERE node:Location MATCH (target :Location) WHERE target.pk <> node.pk CREATE (node)-[r: PATH_TO { distance: distance(point({ latitude: target.lat, longitude: target.lon }), point({ latitude: node.lat, longitude: node.lon })) }]->(target)',
{ phase: 'after' }
);
Query to try out:
CREATE
(random :Location { pk: 1, name: 'random', lat: 50.082010, lon: 14.418595 }),
(random2 :Location { pk: 2, name: 'random2', lat: 49.742635, lon: 14.717182 }),
(media1 :Media { pk: 1, taken_at: 1 }),
(person1 :Person { pk: 1, gender: 'female' })
WITH random, media1, person1
CREATE (person1)-[:TOOK_PHOTO]->(media1)-[:PHOTO_IN]->(random); // this will freeze
But this query works (it will create desired relation):
CREATE (:Location { pk: 1, name: "a", lat: 50.061512, lon: 14.604215});
CREATE (:Location { pk: 2, name: "b", lat: 50.063950, lon: 14.604086});
After I try to see running queries via apoc
there is nothing active. When I try {assignedLabels}
instead of createdNodes
it behaves the same.
Thanks for helping me.