Reputation: 8413
I need to send several relationship IDs to an APOC function in my Neo4J Cypher request:
PROFILE UNWIND $contexts as cons
WITH cons
CALL apoc.index.relationships('TO','context:cons')
YIELD rel, start, end
WITH DISTINCT rel, start, end
WHERE rel.user='15229100-b20e-11e3-80d3-6150cb20a1b9'
RETURN DISTINCT start.uid AS source_id, start.name AS source_name, end.uid AS target_id, end.name AS target_name, rel.uid AS edge_id, rel.context AS context_id, rel.statement AS statement_id, rel.weight AS weight;
My params are as following:
{
"contexts": [
"09a73400-20ab-11e9-a5b3-9fb3da66a7cb",
"0113a5c0-1f8f-11e9-9ff3-8379606e6d34",
"3fb1d040-1f85-11e9-964f-7dc221bb473c",
"1d0d8ed0-1f85-11e9-964f-7dc221bb473c"
]
}
When I send them like
CALL apoc.index.relationships('TO','context:09a73400-20ab-11e9-a5b3-9fb3da66a7cb 0113a5c0-1f8f-11e9-9ff3-8379606e6d34 3fb1d040-1f85-11e9-964f-7dc221bb473c 1d0d8ed0-1f85-11e9-964f-7dc221bb473c')
It works...
How can rewrite my above request so that the ids get passed into the APOC
function?
Upvotes: 0
Views: 266
Reputation: 41706
It's a Lucene query string, so you have to build it up or send it in as parameter:
WITH 'context:('+apoc.text.join($contexts,' ')+')' as query
WITH cons
CALL apoc.index.relationships('TO',query)
...
Upvotes: 1