Database Reference
In-Depth Information
graphStory.userTags = _graphClient.Cypher
.Start(new { u = graphStory.user.noderef })
.Match("u-[:CURRENTPOST]-lp-[:NEXTPOST*0..]-c")
.With("distinct c")
.Match(" c-[ct:HAS]->(t)")
.With("distinct ct, t")
.Return(() => Return.As<MappedContentTag>(" {name: t.wordPhrase, label:
t.wordPhrase, " +
" id: count(*) }" ))
.OrderByDescending("count(*) ")
.Results.ToList();
return graphStory;
}
This is displayed Figure
7-8
in the left-hand column. The display code is located in
{PROJECTROOT}/Views/
Interest/Index.cshtml.
Figure 7-8.
Filtering the current user's content
The
tagsInMyNetwork
method uses two queries, which are shown in Listing 7-38. The
tagsInNetwork
finds users
being followed, accesses all of their content, and finds connected tags through the
HAS
relationship type. Finally, the
method returns an
iterable
of
MappedContentTag
.
The
userTags
method is similar but is concerned only with content and, subsequently, tags connected to the
current user. Both methods limit the results to 30 items. The methods return
MappedContentTag,
which supports
an autosuggest plugin in the view and requires both a label and name to be provided in order to execute. This
autosuggest feature is used in the status update form as well as some search forms found later in this chapter.