I was hoping I could get some guidance on a basic query for getting recommended products for a user where:
there are person nodes w/ transact edges to …
order nodes w/ contains edges to …
products (which have inbound edges from people for view and addtocart events, though they’re not relevant to this example)
A visualization of the graph is included as an attachment.
The query I’m trying to come up with is the following: for a given user, I’m trying to generate a set of products that are related to the products found in the users transacted orders.
A query like:
match (p:person)-[:transact]->(:order)-[:contains]->(purchasedProduct:product)<-[:contains]-(:order)-[:contains]->(reccomendedProduct:product) where p.id=3932 return distinct reccomendedProduct.id
… seems like it should work but returns no results. A few things:
the returned distinct recommendedProduct ids are not removing the products themselves from their list and they should (i.e. distinct reccomendedProduct - purchasedProduct) – it’s unclear whether or not this is possible because of the directionality of the edge (from order to product, but we’re going from product to order…)
the last point assumes that I can travel to the related products order node and then fetch all related, products – this shouldn’t be an issue as the relationship is directional from the order to the product (via the :contains edge)
Do you happen to have any pointers on what might be wrong?
This is from a post I wrote a while back: https://www.joshdurbin.net/posts/2020-1-redis-graph-product-recommendation-part-1-data-loading/.