Database Reference
In-Depth Information
Listing 7-38. The MappedContentTag
public class MappedContentTag
{
public string id {get; set;}
public string label {get; set;}
public string name {get; set;}
}
Filtering Managed Content
Once the list of tags for the user and for the group that she follows has been provided, the content can be filtered
based of the generated tag links, which is shown in Figure 7-8 . If a tag is clicked on the inside of the “My Interests”
section, then the getContentByTag method, displayed in Listing 7-39, will called be with the isCurrentUser value set
to true.
Listing 7-39. getContentByTag in ContentService
public List<MappedContent> getContentByTag(string username, string tag, bool isCurrentUser)
{
List<MappedContent> mappedContent = null;
if (isCurrentUser == true)
{
mappedContent = _graphClient.Cypher.Match(" (u:User {username: {u} }) ")
.WithParam("u", username)
.With("u")
.Match(" u-[:CURRENTPOST]-lp-[:NEXTPOST*0..]-p ")
.With(" DISTINCT u,p ")
.Match(" p-[:HAS]-(t:Tag {wordPhrase : {wp} } )")
.WithParam("wp",tag)
.Return(() => Return.As<MappedContent>(" { contentId: p.contentId, title: p.title,
url: p.url," +
" tagstr: p.tagstr, timestamp: p.timestamp, userNameForPost: u.username, owner:
true } "))
.OrderByDescending("p.timestamp")
.Results.ToList();
}
else
{
mappedContent = _graphClient.Cypher.Match(" (u:User {username: {u} }) ")
.WithParam("u", username)
.With("u")
.Match(" (u)-[:FOLLOWS]->f ")
.With(" DISTINCT f ")
.Match(" f-[:CURRENTPOST]-lp-[:NEXTPOST*0..]-p ")
.With(" DISTINCT f,p ")
.Match(" p-[:HAS]-(t:Tag {wordPhrase : {wp} } )")
.WithParam("wp", tag)
.Return(() => Return.As<MappedContent>(" { contentId: p.contentId, title: p.title,
url: p.url, " +
 
Search WWH ::




Custom Search