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"
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="."}%"
}% %IF{"defined TAG"
then="$percntFORMATLIST{\"%TAG%\" split=\"\s*,\s*\" pattern=\"^(\-)?(.*)$\" format=\"$1tag:$2\" separator=\" \"}$percnt"
}% %IF{"defined CAT"
then="$percntFORMATLIST{\"%CAT%\" split=\"\s*,\s*\" patttern=\"^(\-)?(.*)$\" format=\"$1category:$2\" separator=\" \"}$percnt"
}% %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%.WebSearch\"
tag=\"$term\"
category=\"%CAT{default=""}%\"
web=\"%SUBST{text="%THEWEB{default=""}%" pattern="/" format="."}%\"
union=\"web\"
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"
}%
Calls to 'RenderSolrTagCloud'
Copyright
© 2006-2019 Michael Daum
http://michaeldaumconsulting.com
This file is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read the
LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.