Good mornin',
we're about to integrate Cypher queries into structr (we're deeply
impressed by and love Cypher!!).
Now we'd like to filter the results by relationship properties.
[1]
says, that you can only filter by relationship type.
Use Case: Return all nodes of type 'Page' which have child nodes
that contain the word 'test' in their 'content' attribute. This
works quite well.
START n=node:index(type='Page')
MATCH n-[r:CONTAINS*]->child
WHERE (child.type = 'Content' AND child.content =~ /.*test.*/)
RETURN DISTINCT n
But now we like Cypher to follow relationships with a certain
property value only.
Like this:
START n=node:index(type='Page')
MATCH n-[r:CONTAINS*]->child
WHERE (r.foo = 'bar' AND child.type =
'Content' AND child.content =~ /.*test.*/)
RETURN DISTINCT n
Or this:
START n=node:keywordAllNodes(type='Page')
MATCH n-[r:CONTAINS*, r.foo = 'bar']->child
WHERE (child.type = 'Content' AND child.content =~ /.*test.*/)
RETURN DISTINCT n
Is there any way to achieve this?
We're using 1.7.1, but could use 1.8M* too, if needed.
Thanks
Axel
[1]
http://docs.neo4j.org/chunked/1.7.1/query-where.html#where-filter-on-relationships