I am new to Neo4j,I have the following situation
In the above diagram represented a node with label user
with sub-nodes having label shops
. Each of these sub-nodes have sub-nodes with label items
. Each node items
has attribute size
and the items node is in descending order by size
attribute for each node shops
as represented in the figure.
Question
I want to get two items
node whose size is less than or equal to 17
from each shops
.
How to do that? I tried, but its not working the way I need
Here is what I have tried
match (a:user{id:20000})-[:follows]-(b:shops)
with b
match (b)-[:next*]->(c:items)
where c.size<=17
return b
limit 2
Note- These shops
node can have thousands of items
nodes. So how to find the desired nodes without traversing all thousands of items
nodes.
Please help , thanks in advance.