Hello all,
I am looking for a way to get a label as a string from my user AND use the label optimization in my query (rather than have the engine go for a full DB scan).
2 ways I have found so far of doing so (I'll use the WITH keyword to simulate user input):
1.
WITH "facebook" as company
MATCH p = (a:company)-->(b:company)
RETURN p
This one just won't work, as cypher apparently does not know how to handle form of (node_name:label_name) when label_name is a parameter.
WITH "facebook" as company
MATCH p = (a)-->(b)
WHERE ALL (x IN nodes(p) WHERE company IN labels(x))
RETURN p
This one works, but performs a full DB scan, not using the label optimization benefit for improved performance.
Any ideas?
Thanks!