Database Reference
In-Depth Information
Filtering Connected Content
If a tag is clicked on the inside of the “Interests in my Network” section, then getFollowingContentWithTag method
will be called, as shown in Listing 8-36. The second query is nearly identical the first query found in the interest
route, except it will factor in the users being followed and exclude the current user.
The method also returns a collection of status updates based on the matching tag, placing no limit on the number
of status updates to be returned. In addition, it marks the owner property as true, because you've determined ahead of
time you are returning only the current user's content. The results of calling this method are shown in Figure 8-13 .
Listing 8-36. Get the Content of the Users Being Followed Based on a Tag
public static function getFollowingContentWithTag($username,$wp){
$queryString = " MATCH (u:User {username: {u} })-[:FOLLOWS]->f" .
" WITH DISTINCT f" .
" MATCH f-[:CURRENTPOST]-lp-[:NEXTPOST*0..]-p" .
" WITH DISTINCT f,p" .
" MATCH p-[:HAS]-(t:Tag {wordPhrase : {wp} } )" .
" RETURN p.contentId as contentId, p.title as title, p.tagstr as tagstr, " .
" p.timestamp as timestamp, p.url as url, f.username as username, false as owner" .
" ORDER BY p.timestamp DESC";
$query = new Everyman\Neo4j\Cypher\Query(Neo4Client::client(), $queryString, array(
'u' => $username,
'wp' => $wp
));
$result = $query->getResultSet();
foreach($result as $row){
$row->timestampAsStr = date('n/d/Y',$row['timestamp']) .
' at ' . date('g:i A',$row['timestamp']);
}
return $result;
}
 
Search WWH ::




Custom Search