Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-05-2021 11:36 PM
In desktop edition I am trying to write a query to run a full text search, then using apoc.case run different match queries based on the label of the nodes returned in the full text search, but i'm just getting all results that match the pattern in the case statement and therefore not taking into account the full text search result.
CALL db.index.fulltext.queryNodes("nameSearch", "Sailing") YIELD node as n
with n, labels(n)[0] as label
call apoc.case([
label = "Authority",
"match (a:Incident)-[*4]-(n) return a",
label = "Activity", "match (n)-[]-(a:Incident) return a"
]) YIELD value return value
Does anyone have any ideas? Maybe a foreach statement? As the full text can bring back multiple results.
09-06-2021 05:20 AM
Hi!
You should include n as input param of the case.
CALL db.index.fulltext.queryNodes("nameSearch", "Sailing") YIELD node as n
with n, labels(n)[0] as label
call apoc.case([
label = "Authority",
"match (a:Incident)-[*4]-(n) return a",
label = "Activity", "match (n)-[]-(a:Incident) return a"
], {n:n}) YIELD value return value
Bennu
All the sessions of the conference are now available online