我不知道wat是错的,但我的查询在Neo4j控制台上直接执行时(返回响应)但不会过度休息,它会返回零记录,这可能是愚蠢但不能解决问题。看起来它与将列表作为查询参数传递给' IN'子句(下面的代码片段中的prodIds).Below是我的查询:
MATCH (user:Profile{id:{id}})-[r:INTERESTED_IN]->(category:Category)
with max(r.rank) AS mRANK
MATCH (user:Profile{id:{id}})-[r:INTERESTED_IN{rank:mRANK}]->(category:Category)
with category as interestCat
MATCH (user:Profile)-[r:INTERESTED_IN]->(interestCat)
WITH [x in collect(user)| id(x) ] AS UserIDS
MATCH(user:Profile) where id(user) in UserIDS
MATCH(user)-[:HAS_BOUGHT]->(order:Order)
WITH [x in collect(order)| id(x) ] AS OrderIDs
MATCH (order:Order)-[r:HAS_ITEM]->(product:Product) where **product.prodId in {prodIds} and id(order) in OrderIDs**
WITH product as recommendedProduct , count(r) as productCount
ORDER BY productCount DESC LIMIT 5 return recommendedProduct, productCount