Database Reference
In-Depth Information
$queryString = " MATCH (p:Product), (u:User { username:{u} })" .
" WHERE id(p) = {productNodeId}" .
" WITH u,p" .
" MERGE (u)-[r:VIEWED]->(p)" .
" SET r.dateAsStr={timestampAsStr}, r.timestamp={ts}" .
" WITH u " .
" MATCH (u)-[r:VIEWED]->(p)" .
" RETURN p.title as title, r.dateAsStr as dateAsStr" .
" ORDER BY r.timestamp desc";
$query = new Everyman\Neo4j\Cypher\Query(Neo4Client::client(), $queryString, array(
'u' => $username,
'productNodeId' => $productNodeId,
'timestampAsStr' => $timestampAsStr,
'ts' => $ts,
));
$result = $query->getResultSet();
return self::returnMappedProductUserView($result);
}
Filtering Consumption for Users
One practical use of the consumption model is to create a content trail for users, as shown in Figure 8-14 . As a user
clicks on items in the scrolling product stream, the interaction is captured using createUserViewAndReturnViews ,
which ultimately returns a List of relationship objects of the VIEWED type.
Figure 8-14. The Scrolling Product and Product Trail page
 
Search WWH ::




Custom Search