Database Reference
In-Depth Information
Figure 7-15. Specific Products Purchased by Friends
Listing 7-54. The friendsPurchaseByProduct Method in PurchaseService
public List<MappedProductUserPurchase> friendsPurchaseByProduct(string userId, string title)
{
return _graphClient.Cypher
.Match("(p:Product)")
.Where("lower(p.title) =lower({title})")
.WithParam("title", title)
.With("p")
.Match("(u:User { userId : {userId} } )-[:FOLLOWS]-(f)-[:MADE]->()-[:CONTAINS]->(p) ")
.WithParam("userId", userId)
.Return(() => Return.As<MappedProductUserPurchase>("{productId:p.productId,title:p.
title," +
"fullname:collect(f.firstname + ' ' + f.lastname),wordPhrase:null,cfriends:
count(f) }"))
.OrderByDescending("count(f)")
.Results.ToList();
}
 
Search WWH ::




Custom Search