Refiners in SharePoint 2013 Search

Oh, yes you can have deep refiners with item counts!

Agnes Molnar

by Agnes Molnar on 3/21/2014

Share this:

Article Details

Date Revised:

Applies to:
Microsoft SharePoint, Search, SharePoint 2013, spx

The concept of Refiners is not new. It has been in SharePoint since version 2010, but there was a big difference between refiners in SharePoint 2010 (SP2010) and FAST Search for SharePoint (FS4SP): SP2010 had shallow refiners, while FS4SP has deep refiners with item counts. I've made a comparison of them earlier. Please find my related blog post here.

As you're already aware, SharePoint 2013 has only one integrated Search core (see more details in our e-book here).

After this short introduction and historical info, you might expect that we would have deep refiners in SharePoint 2013, right? It's so logical. But when you open a SP2013 Search Center, you will find something like what you see in Figure 1:


Figure 1: Where are item counts?

It's nice that we have some visual refiner in the bottom, but why don't we have item counts for the text refiners? Are they shallow refiners? If they're shallow, howcome the counts can be represented on the visual diagram-like refiner?

The truth is: We do have deep refiners in SharePoint 2013, which is why the counts can be represented on the Modified Date refiner above. But by default the counts are hidden for text refiners.

In order to display the counts, let me introduce you to the new Refinement Panel. The Refinement Panel is still a web part, but it's very different than it was in the previous versions of SharePoint. When you open its properties, you'll see something like Figure 2:


Figure 2: Refinement Panel

Although some very exciting options are on this panel, I’m going to focus on the Choose Refiners button for now. Once you click on it, a nice and fancy wizard will be displayed, as you see in Figure 3.


Figure 3: Refinement wizard

Let's see what we have here. First, there's a visual control for selecting the refiners we need on our Search page. (Wow, no more Config XML magic! Cool!)

On the left side is the list of available refiners (managed properties). On the right side, we can see our current selections. We can add and remove, as well as reorder, the refiners here.

When we select a refiner in the list in Figure 3, we'll see its configuration in the bottom half of the screen. The things that we can configure here are:

  • Display name

  • Display template (see below)

  • Sort by

  • Sort direction (ASC / DESC)

  • Max number of refiner values

As MSDN says about Display Templates:

"You may want to control the format and presentation of search results on your website. You can do that with display templates, which extend the options available for customizing search results through the user interface beyond mapping the predefined fields that you want to display.

You can use display templates when you want to customize how content displays on your site in a way that goes beyond mapping predefined fields. Display templates are part of the Designer Manager workflow in SharePoint 2013. There are three contexts when you may want to use display templates with search results—when you want to map how the overall structure of search results are presented, when you want to show groups of results, and when you want to show how each result, or item, in the result set is displayed. These are called Control, Group, and Item templates, respectively."(See more here .)

So, in case of refiners, the selected Display Template defines how to display the given refiner. If we open the dropdown, we can see and select the existing templates. Out of the box, we have the following:

  • Refiner Item

  • Multi-value Refiner Item

If we want to display the item counts, we have two options:

  1.     Modify the existing "Refiner Item" display template   

  2.     Create a custom display template.

Let's choose the second option and create our own display template with the name Refiner Item with Item Counts.

To do this, we can go to the Design Manager and create a new one, or we can take the existing Refiner Item (stored as the Master Page gallery / Display Templates / Filters / Filter_Default.html). We can either modify it if we want to modify the behavior of the default one. Or we can create a new one (copy this one and modify what you want changed).

To get the item count, we need to modify two things:

  • Give it a new Title, something like this:

    <title>Refinement Item with Count</title>

  • Look for the value of ShowCounts. By default, it is set to False. This is why the item counts are hidden. Change it to True:  

    this.Options = { 
    ShowClientPeoplePicker: false, 
    ShowCounts: true 

Save your file and upload to the Master Page Gallery.

Note that there's a .js file for every design template. Don't worry about it. This will be created when you upload the HTML.

If you go back to the Refiner Panel's properties and open the Display Template dropdown, you'll see the option Refinement Item with Count, as in Figure 4. 


Figure 4: Refinement Item with Count

Select this for each refiner value you would like to see the counts for. That's it!

You'll see the deep refiners with item counts, in the very same way as you did in FAST Search for SharePoint 2010. And you can also do this on Office 365, as Figure 5 shows.


Figure 5: Refiners in Office 365

Topic: Tutorial

Sign in with

Or register