Database Reference
In-Depth Information
Figure 9-13. Filtering content of the current user's friends
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 only returning the current user's content. The results of calling this method are shown in Figure 9-13 .
Listing 9-34. Get the Content of the User's Being Followed Based on a Tag
def get_following_content_with_tag(self, graph_db, username, wordPhrase):
query = neo4j.CypherQuery(graph_db,
" 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")
params = {"u": username, "wp": wordPhrase}
result = query.execute(**params)
 
Search WWH ::




Custom Search