cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Using results of a full text search in case statement

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.

1 REPLY 1

Bennu
Graph Fellow

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