SharePoint Refiner Quick Tips

In this article I have pulled together some quick tips for working with refiners in SharePoint Search.

Increasing the amount of Refinements in a Refiner

Refiners have two different places for setting the amount of refinement items to display. The first is the “shortListSize” which is a controlled by a variable in the refiner item level display template (these are the items that are displayed before the “SHOW MORE” link.

RefinerIA

You can also control the total amount of items displayed in the refiner (including those shown after clicking on the “SHOW MORE” link) by specifying the amount in the “maxNumberRefinementOptions” property in the “SelectedRefinementControlsJson” node for the relevant refiner (you can set this per refiner).

Showing Refinement Counts

By default refiner counts are not displayed, but fortunately this is easy to change. You can amend the options object at the top of the refiner item level display template to set the counts property to true.

Setting the Refinement Sort Order

If only it were simple – like setting the sort order in the refiner WebPart (either via the UI or in the WebPart XML). The problem is that some OOB refiners ignore this setting (I’m looking at you Result Type) and refuse to order by refinement counts.

If you really really need them to show here to, you can amend the logic on the item level display template:

Notifying any Scripts waiting on your Display Template

Not specifically a refiner display template trick but a really handy one. You can tell any waiting script that depends on your refiner display template that you have finished and are ready to go with the following approach.

Removing Specific Refinements from a Refiner

You can conditionally mark refinement items for deletion and then remove them after this process.

Accessing a Refiner with JavaScript

It is sometimes necessary to access a refiner with JavaScript and apply or remove a refinement.

Elio Stryuf has a great article detailing what’s possible here:

http://www.eliostruyf.com/part-5-search-refiner-control-methods-explained/

SharePoint Refiner Quick Tips

Leave a Reply

%d bloggers like this: