The concept of search refiners is not new, it’s been in SharePoint since the version 2010. But there was a big difference between SharePoint 2010’s refiners and FAST Search for SharePoint’s refiners: while we had shallow refiners in SharePoint 2010 (SP2010), we had deep refiners with item counts in FAST Search for SharePoint (FS4SP). I’ve made a comparison on them earlier, please find my related blog post here.
As you’re already aware of, there’s only one, integrated Search core in SharePoint 2013 (see more details in our e-book here).
After this short introduction and historical info, you might expect we have deep refiners in SharePoint 2013, right? It’s so logical. But when you open a SP2013 Search Center, you find something like this:
It’s nice we have some visual refiner in the bottom, but why we don’t have item counts for the text refiners? Are they shallow refiners? If they’re shallow, how come the counts can be represented on the visual diagram-like refiner?
The truth is the following: we do have deep refiners in SharePoint 2013 (this 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, please let me introduce you the new Refiner Panel.
Refinement Panel is still a web part, but very different than it was in the previous versions. When you open its properties, you’ll see something like this:
Although there are some very exciting options here, please let me focus on the button “Choose Refiners” for now. Once you click on it, a nice and fancy wizard will be displayed:
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 there’s the list of available refiners (managed properties), on the right side you can see your current selections. Of course, you can add and remove as well as reorder the refiners here.
When you select a refiner in the list above, you’ll see its configuration in the bottom half of the screen. Things you can configure here:
- 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 that, in case of refiners, the selected Display Template defines how to display the given refiner. If you open the dropdown, you can see and select the existing templates – out of the box, you have the followings:
- Refiner Item
- Multi-value Refiner Item
If you want to display the item counts, there are two options:
- You can modify the existing “Refiner Item” display template, OR
- You can create a custom display template.
Let me choose the 2nd option and create my own display template, with the name “Refiner Item with Item Counts”.
To do this, you can go to the Design Manager and create a new one, or you can take the existing “Refiner Item” (stored as the Master Page gallery / Display Templates / Filters / Filter_Default.html). You can either modify it (if you want to modify the behavior of the default one) – or create a new one (cop this one and modify what you want to get changed).
There are two things to modify here in order to get the item counts:
-
Give a new Title to it, something like this:
<title>Refinement Item with Count</title>
-
Look for the value “ShowCounts”. By default, it’s 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, there’s a .js file for each other design templates. Don’t worry about it, this will be created when you upload the HTML.
That’s it. If you go back to the Refiner Panel’s properties and open the Display Template dropdown, you’ll see the option “Refiner Item with Count”. Select this for each refiner value you would like to see the counts – 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 don’t forget: you can do this even on Office 365!
Dear Ms. Molnar,
First of all, thank you for your blog and all the info you share about searching in SPS. I found about your blog in November, in one of the SPS Connect sessions in Haarlem. Too bad that you couldn’t make it there, but your friend Matthew McDermott did a good job. And I’m looking forward to your workshop in Wiesbaden :).
I’m currently responsible restructuring a large document library, I overtaken this project somewhere in the middle, without too much technical background from my side. But your blog did help me to realize what was done good and what was bad, how to fix it somehow.
Now I’m stuck with a refiner for a couple of weeks and I don’t find any documentation about my problem.
I’ve got a search results webpart set-up which returns items from this large document library. Alongside it is a refiner web part which refines the results based on a single managed metadata field set on those items (each document is tagged with multiple metadata values). Selecting multiple refiners would result in an OR-type query, returning all results tagged with either of the values. But I would like to have results based on a AND-type query. Is this possible? and if yes, how? Where to read about it?
Thanks a lot in advance!
Kind regards,
Alina Alexandru
Dear Alina,
First of all, thank you for your kind words and great feedback.
Having AND refiners is possible by creating custom refiners. One of the best description if Elyo’s post here: https://www.eliostruyf.com/part-6-create-multi-value-search-refiner-control/ (as part of a blog post series – the whole series is amazing!!)
I hope this helps.
-Agnes