Last active
December 25, 2015 08:19
-
-
Save yanatan16/6945507 to your computer and use it in GitHub Desktop.
Simple neo4j recommendation engine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE (u:User { user })-[:BUYS]->(p:Product { product }) RETURN u, p; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
START u=node({ user_node_id }) | |
MATCH (u:User)-[r1:BUYS]->(u2:User)<-[r2:BUYS]-(p2:Product)->[r3:BUYS]->(p:Product) | |
WHERE r1 <> r2 AND r2 <> r3 | |
RETURN p, COUNT(p) as score | |
ORDER BY score DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment