Database Reference
In-Depth Information
}
catch (Exception e) {
log.error(e);
}
return SUCCESS;
}
The action method calls the friendsPurchaseTagSimilarityAndProximityToLocation method shown in
Listing 12-50. The query begins starts with a location search within a certain distance, then matching the current
user's tags to products. Next, the query matches friends based the location search. The resulting friends are matched
against products that are in the set of user tag matches. The result of the query is shown in Figure 12-21 .
Figure 12-21. Products Purchased by Friends Nearby and Matches User's Tags
Listing 12-50. friendsPurchaseTagSimilarityAndProximityToLocation Method in the PurchaseDAO Class
public List<MappedProductUserPurchase> friendsPurchaseTagSimilarityAndProximityToLocation(Double
lat, Double lon, Double distance, String username) {
try {
ResultSet rs = cypher.resultSetQuery(
"START n = node:geom({1}) " +
" WITH n " +
" MATCH (u:User { username : {2} } )-[:USES]->(t)<-[:HAS]-p " +
" WITH n,u,p,t " +
" MATCH u-[:FOLLOWS]->(f)-[:HAS]->(n) " +
" WITH p,f,t " +
" MATCH f-[:MADE]->()-[:CONTAINS]->(p) " +
" RETURN p.productId as productId, " +
" p.title as title, " +
" collect(f.firstname + ' ' + f.lastname) as fullname, " +
" t.wordPhrase as wordPhrase, " +
" count(f) as cfriends " +
Search WWH ::




Custom Search