Documentation
This renders a tag cloud getting tags from a solr search on recently changed data.
Parameters
- DAYS: number of recent days of changes to take under consideration, defaults to unlimited
- RECENCY: maximum number of topics to harvest tags from, defaults to 100; a value of "all" will render a tag cloud considering all matching documents
- LIMIT: maximum number of tags in the could, defaults to 100
- MIN: minimum frequency of a tags to be shown
- TAG: comma separated list of tags to be searched for in the archive; tags may be preceded with a dash (-) to exclude results containing this tag
- CAT: comma separated list of categories to search for; categories may be preceded with a dash (-) to exclude results containing this tag
- KEYWORDS: keywords to filter for
- THEWEB: web to restrict search to, defaults to all
- TYPE: content type to restrict results to, e.g. "topic" (default), "image", "video", "pdf", "zip", ..., defaults to "topic"
- SEARCHTOPIC: search topic, defaults to WebSearch
Implementation
%STARTINCLUDE%<noautolink>
%DBCALL{"%WEB%.%TOPIC%"
section="search"
keywords="%KEYWORDS{default=""}%"
theweb="%SUBST{text="%THEWEB{default="all"}%" pattern="/" format="."}%"
limit="%LIMIT{default="100"}%"
filter="type:%TYPE{default="topic"}% %IF{"defined THEWEB and $THEWEB!='all'"
then="web:%SUBST{text="%THEWEB{default=""}%" pattern="/" format="."}%"
}% %FORMATLIST{
"%TAG{default=""}%"
split="\s*,\s*"
pattern="^(\-)?(.*)$"
format="$1tag:$2"
separator=" "
}% %FORMATLIST{
"%CAT{default=""}%"
split="\s*,\s*"
pattern="(\-)?(.*)"
format="$1category:$2"
separator=" "
}% %IF{"defined DAYS"
then="date:\\"[NOW/DAY-%DAYS%DAY TO NOW]\\""
}%"
}% %TAGCLOUD{
terms="%SOLRFORMAT{
"solrtagcloud1"
format_tag="$key:$count,"
separator_tag=" "
}%"
header="<div class='solrTagCloud clsTagCloud'>"
format="<span style='font-size:$weightpx;line-height:110%'><a href='$percntSOLRSCRIPTURL{
topic=\"%BASEWEB%.%SEARCHTOPIC{default="WebSearch"}%\"
tag=\"$term\"
category=\"%CAT{default=""}%\"
web=\"%SUBST{text="%THEWEB{default=""}%" pattern="/" format="."}%\"
union=\"web, type\"
type=\"%TYPE{default="topic"}%\"
}$percnt' style='color:$fadeRGB(%TAGCLOUD_START{default="111,169,255"}%,%TAGCLOUD_END{default="0,89,224"}%);' class='solrFacetValue tag_$term' name='tag_$term' value='$term'>$term</a></span>"
footer="</div>"
group="<strong>$group</strong> "
split="\s*,\s*"
buckets="25"
offset="13"
warn="off"
min="%MIN{default="0"}%"
}%</noautolink>%STOPINCLUDE%
%STARTSECTION{"search"}%%SOLRSEARCH{
"%keywords%"
id="solrtagcloud1"
sort="date desc"
type="edismax"
fields=""
web="%theweb%"
filter="%filter% %IF{"$RECENCY != 'all'"
then="$percntSOLRSEARCH{\"%keywords% tag:*\"
sort=\"date desc\"
type=\"edismax\"
fields=\"id\"
web=\"%theweb%\"
filter=\"%filter%\"
rows=\"%RECENCY{default="100"}%\"
format=\"$id\"
separator=\" OR \"
header=\"id:(\"
footer=\")\"
}$percnt"}%"
facets="tag"
facetlimit="%limit%"
rows="30"
}%%ENDSECTION{"search"}%
Test
%SOLRSEARCH{
""
id="solrtagcloud1"
sort="date desc"
type="edismax"
fields=""
web="all"
filter="type:topic -tag:foo tag:bar %SOLRSEARCH{" tag:*"
sort="date desc"
type="edismax"
fields="id"
web="all"
filter="type:topic -tag:foo tag:bar "
rows="100"
format="$id"
separator=" OR "
header="id:("
footer=")"
}%"
facets="tag"
facetlimit="100"
rows="30"
}% %TAGCLOUD{
terms="%SOLRFORMAT{
"solrtagcloud1"
format_tag="$key:$count,"
separator_tag=" "
}%"
header="
"
format="<a href='$percntSOLRSCRIPTURL{
topic=\"Applications/ClassificationApp.WebSearch\"
tag=\"$term\"
category=\"\"
web=\"\"
union=\"web\"
type=\"topic\"
}$percnt' style='color:$fadeRGB(111,169,255,0,89,224);' class='solrFacetValue tag_$term' name='tag_$term' value='$term'>$term"
footer="
"
group="
$group "
split="\s*,\s*"
buckets="25"
offset="13"
warn="off"
min="0"
}%