Database Reference
In-Depth Information
" WITH distinct c " +
" MATCH c-[ct:HAS]->(t) " +
" WITH distinct ct,t " +
" RETURN t.wordPhrase as name, count(ct) as count " +
" ORDER BY count desc " +
" SKIP 0 LIMIT 30")
Iterable<MappedContentTag>
tagsInNetwork
(@Param("nodeId") Long nodeId);
@Query("START u=node({nodeId})" +
" MATCH u-[:CURRENTPOST]-lp-[:NEXTPOST*0..]-c " +
" WITH distinct c " +
" MATCH c-[ct:HAS]->(t) " +
" WITH distinct ct,t " +
" RETURN t.wordPhrase as name, count(ct) as count " +
" ORDER BY count desc " +
" SKIP 0 LIMIT 30")
Iterable<MappedContentTag>
userTags
(@Param("nodeId") Long nodeId);
}
The methods return
MappedContentTag
, which is located inside the
MappedContentTagRepository
interface.
Notice that the
MappedContentTag
uses two getter methods with the same result column:
name
. This is done to support
a specific autosuggest plugin in the view, which requires both a label and name to be provided in order to execute.
This autosuggest feature is used in the status update form and in some search forms presented later in this chapter.
Listing 11-42.
The
MappedContent
Interface
@QueryResult
@JsonPropertyOrder(alphabetic = true)
@NodeEntity
public interface
MappedContentTag
{
@ResultColumn("count")
String getId();
@ResultColumn("name")
String getLabel();
@ResultColumn("name")
String getName();
}
Filtering Managed Content
Once the list of tags for the user and for the group she follows has been provided, the content can be filtered based
on the generated tag links, as shown in Figure
11-12
. If one of the user's tags is clicked, then the
getContentByTag
method, displayed in Listing 11-43, will be called with the
userscontent
value set to true.