Documentation
Parameters
- NAME: name of the formfield to render the editor for
- VALUE: list of pre-selected tags
- THEWEB: current web
- THETOPIC: current topic
- SIZE: the size of the input field
Implementation
%STARTINCLUDE%<div class="clsTagEditor"><noautolink>
<input type="text" class="foswikiInputField jqTextboxList {autocomplete:'%SCRIPTURL{"rest"}%/RenderPlugin/template?topic=%THEWEB%.%THETOPIC%;name=classificationplugin;expand=querytags'}" name="%NAME%" id="%NAME%" size="%SIZE%" value="%IF{"defined VALUE" then="%VALUE%"}%" />
%IF{"context SolrPluginEnabled" then="%DBCALL{"%WEB%.%TOPIC%" section="tagsuggestion"}%"}%
</noautolink></div>%STOPINCLUDE%
Tag suggestion via SolrPlugin
%STARTSECTION{"tagsuggestion"}%<!-- -->
%FORMATLIST{
"%SOLRSIMILAR{
"id:%THEWEB%.%THETOPIC%"
like="category,tag"
facets="tag"
facetlimit="20"
facetmincount="5"
mindocumentfrequency="10"
filter="type:topic web:%THEWEB%"
format_tag="$key=$count"
separator_tag=","
}%"
exclude="%FORMATLIST{"%VALUE%" split="\s*,\s*" format="\b($1=\d+)\b" separator="|" replace="-=\-,\[=\\[,\]=\\]"}%"
split="\s*,\s*"
pattern="(.*)=(.*)"
header="$n$n<hr />$n$n<h3>%MAKETEXT{"Related tags"}%:</h3><ol>"
format="<li><a class='clsTagSuggestion' href='#'>$1</a>
<span class='foswikiGrayText'>... %MAKETEXT{"found in [_1] other topic(s)" args="$2"}%</span>
</li>"
footer="</ol>"
separator="$n"
}%
<!-- -->%ENDSECTION{"tagsuggestion"}%
Test
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.