'Neo4j Cypher - Filtering nodes by Input nodes in common Doesn't resolve
I have a large DB >1m customers, >100k products
I am trying to build a product recommendation out of real-time data. However, the first query I build never resolves. (or at least I stop it after 30 min)
I want to INPUT a customer and Get All the Uses of the products they purchase. Then I want to get ALL Customers who have those same Uses AND More. (I was going to do things after that but can't get past this part)
ALL nodes are INDEXED on a unique ID.
MATCH (c:customer {customer_id:'0c4c518e5d1eaf3fc39f93463c2406ad8b659d6c22c9107179e3992f647b12aa'})-[:PURCHASE]->(p:product)-[:HAS]->(u:use)
WITH DISTINCT(u.section_id) as uses
MATCH (ac:customer)-[:PURCHASE]->(ap:product)-[:HAS]->(au:use)
WHERE au.section_id in uses
RETURN ac
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
