Search Guys

Everything search, including product commentary and guidance, search strategies and general technical guidance

Multi-select refiners and taxonomy managed properties

Multi-select refiners and taxonomy managed properties

  • Comments 1
  • Likes

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
  • Having the same issue you describe. Need help applying your solution however. Can you provide a more detailed description of your solution. You say you replaced the value of useContains in the template, but you don't say what you replaced the term with.

    I assume your fix was to the code block for the onclick event for the "OtherValue" div. Can you please post what your line looked like afterwards. I can find nothing on the "Srch.Refinement.multiRefinerSpecifyOtherFilterValue" and how you were able to remove the "equals()" out of the function call.

    Thanks


Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment