Refinement panel character display limitation

6 Feb

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 global termset. The termset is the parent of a few terms and all of these terms have one or more children itself. A termtree.
The display format of the column is set to ‘Display the entire path to the term in the field’.
Managed metadata column

A few documents are uploaded to the library and the metadata column is set to one of the terms.
A full crawl is completed and the refinement panel shows the metadata refiner.
The refinement panel now looks like this:
Refinement panel with child terms

As can be seen, not the whole fieldvalue is displayed. That’s weird. How do I know which one to use if not the whole value can be seen?
Maybe it’s a css issue or the left column of the screen isn’t wide enough? Starting up Firebug and checking out the value:
Firebug shows value

The whole value isn’t present as text to display in the panel! I was seriously surprised!
SharePoint returns only the first 19 characters and three dots…

But… hover over de terms and the whole path is displayed. But that’s not a satisfactory solution, the values have to be displayed properly!

Ok, I agree displaying the whole term tree path isn’t that useful in this case, but it’s needed somewhere else in the site, so the display format of the site column has to stay ‘Display the entire path to the term in the field’.
It 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.

Displaying the last term value

The xslt of the refinementpanel can be adjusted to display the last term value now we know the tooltip does know the whole value.

Original xslt:

 <a href="{$SecureUrl}" title="{$RefineByHeading}: {$UrlTooltip}">
  <xsl:value-of select="Value"/>

The new xslt looks a little bit different than that.
First the fieldvalue has to be analyzed if it contains ‘:’. The ‘:’ means the value is a child term and the whole tree path is displayed.
From the value which contains the whole tree path the last term is filtered by a recursive xslt template ´substring-after-last´.
Then 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’t contain this value. Confusing, isn’t it?

<xsl:variable name="PartOfValue">
 <xsl:call-template name="substring-after-last">
  <xsl:with-param name="string" select="Value" />
  <xsl:with-param name="delimiter" select="':'" />

<xsl:variable name="PartOfTooltip">
 <xsl:call-template name="substring-after-last">
  <xsl:with-param name="string" select="$UrlTooltip" />
  <xsl:with-param name="delimiter" select="':'" />

 <xsl:when test="($FilterCategoryType = 'Microsoft.Office.Server.Search.WebControls.TaxonomyFilterGenerator') and ($PartOfValue != '')">
  <xsl:if test="not(contains($PartOfValue, '…'))">
   <xsl:value-of select="$PartOfValue"/>
  <xsl:if test="contains($PartOfValue, '…')">
   <xsl:value-of select="$PartOfTooltip"/>
  <xsl:value-of select="Value"/>

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… To solve an empty tooltip, check out my next post.

After the xslt has been implemented the refinementpanel looks like the picture below
Adjusted refinementpanel

And the tooltip displays the whole term tree:

SharePoint returns only the first 19 characters, so what happens when a term itself exists of 19 or more characters?
Refinement panel with long term

On the one hand it’s great the 19 character limitation of displaying a whole termtree isn’t applied to this term, on the other hand, it doesn’t look very nice when the text continues outside the refinement panel.


The values of the refinement panel have a 19 character display limit. When displaying a whole termtree it’s likely this limitation will be exceeded. Just a few xslt adjustments are necessary to display the fieldvalues correct again.

2 Replies to “Refinement panel character display limitation

  1. Great post however can you please confirm where this needs to be added? i have replaced the following section:

    with the new XLST referenced above however it still doesnt show the correct labels.

    please advise how to proceed.


  2. It has to be replaced in the xslt of the refinement panel. The original xslt as described above has to be replaced with the whole block which is displayed right underneath it.

    Hope this helps!

Comments are closed.