{"id":1333,"date":"2012-02-06T15:51:39","date_gmt":"2012-02-06T14:51:39","guid":{"rendered":"http:\/\/www.itidea.nl\/?p=1333"},"modified":"2015-09-08T20:36:37","modified_gmt":"2015-09-08T18:36:37","slug":"refinement-panel-character-display-limitation","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/refinement-panel-character-display-limitation\/","title":{"rendered":"Refinement panel character display limitation"},"content":{"rendered":"<p>Search refiners can contain managed metadata fields to refine the results. Sometimes the display mode of the values look a bit weird in the refinement panel.<\/p>\n<p>Suppose a sitecolumn of a library is a managed metadata column bound to a global termset. The termset is the parent of a few terms and all of these terms have one or more children itself. A termtree.<br \/>\nThe display format of the column is set to &#8216;Display the entire path to the term in the field&#8217;.<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1338\" title=\"Managed metadata column\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner01.png\" alt=\"Managed metadata column\" width=\"414\" height=\"397\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner01.png 414w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner01-300x287.png 300w\" sizes=\"auto, (max-width: 414px) 100vw, 414px\" \/><\/a><\/p>\n<p>A few documents are uploaded to the library and the metadata column is set to one of the terms.<br \/>\nA full crawl is completed and the refinement panel shows the metadata refiner.<br \/>\nThe refinement panel now looks like this:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1340\" title=\"Refinement panel with child terms\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner02.png\" alt=\"Refinement panel with child terms\" width=\"166\" height=\"147\" \/><\/a><\/p>\n<p>As can be seen, not the whole fieldvalue is displayed. That&#8217;s weird. How do I know which one to use if not the whole value can be seen?<br \/>\nMaybe it&#8217;s a css issue or the left column of the screen isn&#8217;t wide enough? Starting up Firebug and checking out the value:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1341\" title=\"Firebug shows value\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner03.png\" alt=\"Firebug shows value\" width=\"697\" height=\"171\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner03.png 697w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner03-300x73.png 300w\" sizes=\"auto, (max-width: 697px) 100vw, 697px\" \/><\/a><\/p>\n<p>The whole value isn&#8217;t present as text to display in the panel! I was seriously surprised!<br \/>\nSharePoint returns only the first 19 characters and three dots&#8230;<\/p>\n<p>But&#8230; hover over de terms and the whole path is displayed. But that&#8217;s not a satisfactory solution, the values have to be displayed properly!<\/p>\n<p>Ok, I agree displaying the whole term tree path isn&#8217;t that useful in this case, but it&#8217;s needed somewhere else in the site, so the display format of the site column has to stay &#8216;Display the entire path to the term in the field&#8217;.<br \/>\nIt would be great to have on option to show only the last term value despite the column display format. An excellent configuration place would be an extra attribute in the filter categories definition xml.<\/p>\n<h3>Displaying the last term value<\/h3>\n<p>The xslt of the refinementpanel can be adjusted to display the last term value now we know the tooltip does know the whole value.<\/p>\n<p>Original xslt:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n &lt;a href=&quot;{$SecureUrl}&quot; title=&quot;{$RefineByHeading}: {$UrlTooltip}&quot;&gt;\r\n  &lt;xsl:value-of select=&quot;Value&quot;\/&gt;\r\n &lt;\/a&gt;\r\n<\/pre>\n<p>The new xslt looks a little bit different than that.<br \/>\nFirst the fieldvalue has to be analyzed if it contains &#8216;:&#8217;. The &#8216;:&#8217; means the value is a child term and the whole tree path is displayed.<br \/>\nFrom the value which contains the whole tree path the last term is filtered by a recursive xslt template \u00b4substring-after-last\u00b4.<br \/>\nThen a check has to be performed if the last term value contains the three dots. If it does, the last term value should be taken from the tooltip value, because the xslt Value doesn&#8217;t contain this value. Confusing, isn&#8217;t it?<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;xsl:variable name=&quot;PartOfValue&quot;&gt;\r\n &lt;xsl:call-template name=&quot;substring-after-last&quot;&gt;\r\n  &lt;xsl:with-param name=&quot;string&quot; select=&quot;Value&quot; \/&gt;\r\n  &lt;xsl:with-param name=&quot;delimiter&quot; select=&quot;':'&quot; \/&gt;\r\n &lt;\/xsl:call-template&gt;\r\n&lt;\/xsl:variable&gt;\r\n\r\n&lt;xsl:variable name=&quot;PartOfTooltip&quot;&gt;\r\n &lt;xsl:call-template name=&quot;substring-after-last&quot;&gt;\r\n  &lt;xsl:with-param name=&quot;string&quot; select=&quot;$UrlTooltip&quot; \/&gt;\r\n  &lt;xsl:with-param name=&quot;delimiter&quot; select=&quot;':'&quot; \/&gt;\r\n &lt;\/xsl:call-template&gt;\r\n&lt;\/xsl:variable&gt;\r\n\r\n&lt;xsl:choose&gt;\r\n &lt;xsl:when test=&quot;($FilterCategoryType = 'Microsoft.Office.Server.Search.WebControls.TaxonomyFilterGenerator') and ($PartOfValue != '')&quot;&gt;\r\n  &lt;xsl:if test=&quot;not(contains($PartOfValue, '\u2026'))&quot;&gt;\r\n   &lt;xsl:value-of select=&quot;$PartOfValue&quot;\/&gt;\r\n  &lt;\/xsl:if&gt;\r\n  &lt;xsl:if test=&quot;contains($PartOfValue, '\u2026')&quot;&gt;\r\n   &lt;xsl:value-of select=&quot;$PartOfTooltip&quot;\/&gt;\r\n  &lt;\/xsl:if&gt;\r\n &lt;\/xsl:when&gt;\r\n &lt;xsl:otherwise&gt;\r\n  &lt;xsl:value-of select=&quot;Value&quot;\/&gt;\r\n &lt;\/xsl:otherwise&gt;\r\n&lt;\/xsl:choose&gt;\r\n<\/pre>\n<p>If the fieldvalue contains less than 19 characters, no dots are displayed and the value can be used, but in that case the urltooltip is empty&#8230; To solve an empty tooltip, check out <a href=\"https:\/\/www.itidea.nl\/index.php\/empty-tooltip-in-refinement-panel\/\">my next post<\/a>.<\/p>\n<p>After the xslt has been implemented the refinementpanel looks like the picture below<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner041.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1345\" title=\"Adjusted refinementpanel\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner041.png\" alt=\"Adjusted refinementpanel\" width=\"148\" height=\"148\" \/><\/a><\/p>\n<p>And the tooltip displays the whole term tree:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner06.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1346\" title=\"Tooltip\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner06.png\" alt=\"Tooltip\" width=\"256\" height=\"148\" \/><\/a><\/p>\n<p>SharePoint returns only the first 19 characters, so what happens when a term itself exists of 19 or more characters?<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner05.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1343\" title=\"Refinement panel with long term\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2012\/02\/MMDRefiner05.png\" alt=\"Refinement panel with long term\" width=\"201\" height=\"148\" \/><\/a><\/p>\n<p>On the one hand it&#8217;s great the 19 character limitation of displaying a whole termtree isn&#8217;t applied to this term, on the other hand, it doesn&#8217;t look very nice when the text continues outside the refinement panel.<\/p>\n<h3>Summary<\/h3>\n<p>The values of the refinement panel have a 19 character display limit. When displaying a whole termtree it&#8217;s likely this limitation will be exceeded. Just a few xslt adjustments are necessary to display the fieldvalues correct again.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Search refiners can contain managed metadata fields to refine the results. Sometimes the display mode of the values look a bit weird in the refinement panel. Suppose a sitecolumn of a library is a managed metadata column bound to a &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/refinement-panel-character-display-limitation\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[42,34],"class_list":["post-1333","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2010","tag-sharepoint-2010","tag-xslt"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=1333"}],"version-history":[{"count":13,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1333\/revisions"}],"predecessor-version":[{"id":2042,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1333\/revisions\/2042"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=1333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=1333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=1333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}