Freigeben über


Multi-select refiners and taxonomy managed properties

In SharePoint 2013 you can use the “Multi-value Refinement Item” display template to allow users to choose multiple refinement values that will be searched for with OR logic.  In the following example, when I click “Apply” the results will be narrowed to any that match Audit or CPO

image

The neat thing is the “Other Value” which allows users to enter their own values here that might not appear at the top of the refinement list.  So in the next example, Apply will find results that match Audit, CPO or Tax

image

This works all well and good until you try it with a managed property populated from the Managed Metadata Term Store.  Now the checkboxes will work but the Other Value will always return no results, even if you enter in the exact value that you see in the top refinement results.   The reason for this is that the data in the refinement values is actually the unique identifier from the taxonomy

nav4.png

and the Other Value is being searched for using the Equals() operator.     You can see this by decoding the URL generated after clicking on Apply.   Just clicking the “HR” check box shows that it is searching for the id portion only:

image

while entering “HR” into the other box uses the equals() operator:

image

which clearly won’t match.

There is a workaround however.  In the Filter_MultiValue_Body.html template there is an option to override the equals to instead just searches for the string:

image

I haven’t (yet) figured out how to set the csr_useContains on the refinement control, but overriding the useContains variable in the template itself is easy enough and gets the job done:

image

The only downside of this is that you could run into situations where you match more than you’d intended.  But you can use wildcards which could be handy.

Comments

  • Anonymous
    May 08, 2014
    The comment has been removed