共用方式為


How to add refiners to your search results page in SharePoint 2013

This is a blog post in the series, “Set up a Search Center in SharePoint 2013”. 

In the previous blog post, I showed you how to identify refiners, and told you about refinable managed properties. In this post you’ll learn:

 

How to map a crawled property to a refinable managed property
In my Search Center scenario, I knew that I wanted to use the following refinable managed properties:

Refiner to use Refinable managed property
Manager RefinableString01
Internal Writer RefinableString02
Editor RefinableString03
Content Type RefinableString04
Requested Publish Date RefinableDate01

The procedure to map a crawled property to a refinable managed property is the same for all refiners. In the procedure below, I’ll show you how you can do this. As an example, I’ll show you how I mapped the crawled property that represents Internal Writer to the RefinableString01 refinable managed property.

  1. On your Search Center, on the Site Settings page, select Search Schema.

Selece Search Schema from Site Settings page

  1. In the Managed property field, type the name of the refinable managed property to which you want to map a crawled property, and then click the arrow button.

    In my scenario, I typed RefinableString01.

Enter refinable managed property name

  1. From the Property Name field, select Edit/Map Property.

Edit/Map Property

  1.  On the Edit Managed Property page, click Add a Mapping.

Add a mapping to refinable managed property

  1. In the Crawled property selection dialog box, use the Search for crawled property name field to search for the crawled property that you want to map to this refinable managed property.

    In my scenario, I knew that I wanted to use the site column called Internal Writer. Crawled properties don’t contain spaces, so I left the space out and entered InternalWriter.

Search for crawled property
         Two crawled properties were found: ows_q_USER_Internal_Writer and ows_Internal_Writer.

Two crawled properties found

If you now look like a big question mark, trust me, I understand your confusion. This part is quite tricky. There are actually two crawled properties (very strange since we only have one Internal Writer site column), so which one should you choose to map to the refinable managed property?

OK, let's take a closer look at what’s going on. The difference between the two crawled properties is the prefix. One has a ows_q_USER_ prefix, and the other ows_.  
Now here’s the important part: When mapping a crawled property to a refinable managed property, you should select the crawled property with the ows_ prefix!

In another blog post I talk about the naming convention for crawled and managed properties. For more information, see From site column to managed property – What’s up with that?

  1. Select the crawled property with the ows_ prefix, and click OK.

    In my scenario, I selected ows_Internal_Writer.

Select crawled property with ows_ prefix

On the Edit Managed Property page, notice that the crawled property has been added to the Mappings to crawled property field.

  1. In the Alias field, enter a name for the refiner.

    In my scenario, I entered InternalWriter.

Enter an alias

It's important to understand that the alias that you enter here is not the refiner name that will be shown on your search results page. This alias is meant to make your life a bit easier when you’re configuring refiners in the Refinement Web Part (I’ll show you how to do this in the procedure below). Remember, you can't change the name of the refinable managed property, so when you do the configuration, you’ll have to deal with quite a few refinable managed properties that have similar names; RefinableString01, RefinableString02 etc.  So the alias is a good reminder of which value you mapped to the property.

  1. To finish the mapping, click OK.

Finalize mapping

I repeated the steps from the procedure above for the remaining four refiners. The screenshots below show my final result.

The mapped date refiners

The mapped string refiners

 

How to initiate a reindexing of a list or library
When you’ve mapped all the rfinable managed properties that you want to use, you have to do a reindexing of your list or library. I showed you how to do this in a previous blog.

 

How to configure the Refinement Web Part to use custom refiners
By default, the Refinement Web Part is included on the search results page. In the previous blog post I showed you how to configure the Search Results Web Part to use a new result source. The two refiners Author and Modified date were also displayed. 

Default refiners displayed

To display custom refiners, here’s what you should do:

  1. On the search results page, click the Settings menu, and then click Edit Page.
  2. In the Refinement Web Part, click the Web Part Menu, and then click Edit Web Part.

Edit Refinement Web Part

  1. In the Web Part tool pane, click Choose Refiners.

Choose refiners

  1. In the Selected refiners section, select the refiners that you don’t want to display on your search results page, and click Remove.

    In my scenario, I removed all the default refiners.

Remove refiners

  1. In the Available refiners section, scroll down and select a refinable managed property.

    In my scenario, I selected RefinableString1. This is the refinable managed property that I mapped to the crawled property ows_Internal_Writer. Notice that sample values are shown (a good sign that we’re on the right path), along with the alias InternalWriter.

Select a refinable managed property

  1. Click Add.

Add refinable managed property

This moves the RefinableString01 property over to the Selected refiners section. When a refiner is moved over to the Selected refiners section, additional configuration options are shown (I'll go through them in steps 10 and 11).

Additional refiner configuration options

  1. Repeat steps 5 and 6 to add all the refiners that you want to use on your search results page.

    In my scenario, I added the five refinable managed properties I configured in the previous section. 

All selected refiners

  1. To preview the refiners, click Preview Refiners.

Preview refiners

  1. To change the display order of refiners, select the refiner you want to move, and then click the Move up or Move down button.

    In my scenario, I selected RefinableString04 (notice the Alias name), and selected Move up until it was the first property in the Selected refiners section.

Move refiner up

  1. To enable users to select multiple refiner values, from the Display template menu, select Multi-value Refinement Item.

Select Multi-value Refinement Item

I clicked Preview refiners again, and verified that the ContentType refiner (RefinableString04) was displayed first, and that it had checkboxes that would enable users to select multiple refiner values.

I repeated this step for the refiners RefinableString01, RefinableString02 and RefinableString03.

But I wasn’t quite satisfied with the way my RefinableDate01 refiner was displayed. Remember, this refiner represents Requested publish date. By default, the refiner values are shown in a list, which makes it difficult for users to see the date range.

Default display of date refiner

To display the refiner values in a more user friendly way, in the Refinement configuration dialog box, from the Display template menu, I selected Slider with bar graph. In the Dates section, I selected Last day, week, month, six months and year.

Configure date refiner to display as slider with bar

When I now previewed my refiners, the values for the Requested Publish Date refiner (RefinableDate01) were nicely displayed as a graph.

Date refiner displayed as slider with graph

But there was one more thing that I had to improve: the refiner display names. RefinableString01, RefinableString02 etc. does not make much sense to users.

  1. To change the refiner display name, in the Display name field, enter the name you want to be displayed for each refiner.

    In my scenario, for the RefinableString04 refiner, I entered Content Type.

Change refiner display name

Repeat this step for all your refinable managed properties.

  1. To save the configurations, click OK in the Refinement configuration dialog box, and then OK in the Web Part tool pane.

  2. Save the page.

    In my scenario, the five refiners were now nicely displayed on the search results page.

Refiners configured

However, there was one small detail that would make the refiners even better.  Right now users couldn’t see any numeric details for the refiner values. For example, I could see that I (Bella Engen) was a writer of articles that had to do with search configuration, but I couldn’t see how many articles.

Refiner counts not displayed

To see this information, I need to add counts to the refiner values.

 

 

How to add counts to refiner values
To add counts to refiner values, you’ll have to edit a display template. When you work with display templates, you'll make life a lot easier for yourself if you map your network drive. By doing this, you’ll be able to work with display templates from Windows Explorer. I describe how you can map your network drive in this blog article.

  1. In your mapped network drive, go to Display Templates --> Filters.

  2. To add counts to refiners where it’s only possible to select one refiner value at a time, open the HTML file Filter_Default. To add counts to refiners where it’s possible to select multiple refiner values, open the HTML file Filter_MultiValue.

    In my scenario, I had configured the refiners so that users would be able to select multiple refiner values, so I opened the file Filter_MultiValue.

  3. Change the value for ShowCounts to true.

Edit display template to show counts

  1. Save the file.

To verify that refiner counts are displayed, enter a query in your search center.

In my scenario, I could now see that I (Bella Engen) was the writer of 5 articles that had something to do with search configuration. Nice!

Refiners with counts

 

Next blog article in this series
How to add a custom search vertical to your search results page

Comments

  • Anonymous
    January 01, 2003
    Hi Syims,

    From what I can tell, you aren't doing anything wrong.
    I suggest that you contact Microsoft Support for further assistance.

    Bella

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Hi Greg, Great question :-) Like you said, I could have used “Content Type”, but used a refinable string managed property just for consistency. Bella

  • Anonymous
    January 01, 2003
    Hi Angelina,

    I didn't mean the display templates or pages, but the items that contain the values. If these are not approved, then they will not be added to the search index.

    Bella

  • Anonymous
    January 01, 2003
    Hi Sudheer,

    I have never tried this myself, but I believe you can to this by customizing the display template that you use to display your refiners.

    Bella

  • Anonymous
    January 01, 2003
    Hi Perl,

    You don't have to do anything different in your production environment to show refiners. From what you describe, it seems that you could have a difference between your test environment and your production environment that causes your issue.

    Bella

  • Anonymous
    January 01, 2003
    About my previous comment, I found that it works on the main search but not in a search result page for a collection site. Is there a way to edit the refiners in the results page of a collection site?

  • Anonymous
    January 01, 2003
    Hi Bella,

    thanks very much for this easy to follow step by step instruction. Just what I was looking for.
    Ran in to one problem though. My refiners show the ID's to the metadata terms instead of the terms itself. Any ideas on what I am doing wrong?

    Thanks in advance
    Yvonne

  • Anonymous
    January 01, 2003
    Hi KlompSY,

    I'm not quite sure how to fix this, but can you tell me the site colum type that your refiner is based on? Also, are you using an automatically generated managed property as your refiner?

    Thanks,
    Bella

  • Anonymous
    January 01, 2003
    Good Info, Thanks for posting Bella

  • Anonymous
    January 01, 2003
    Hi Didier, Have you tried to use the managed property SPContentType as refiner?
    I haven’t tested this myself, but I think it’ll do what you describe. Hope this helps,
    Bella

  • Anonymous
    January 01, 2003
    Hi Bella,
    site colum type is Managed metadata. I used the managed property ows_columname and mapped it to a RefinableString. Hope that answers your questions.
    Thanks Yvonne

  • Anonymous
    January 01, 2003
    Hi SyIMS,

    Are you sure that width value is actually captured in the PictureWidth managed property?
    For your description, it seems like the width value is actually captured by another managed property, which is why search results are returned when you search for 1024.

    Bella

  • Anonymous
    January 01, 2003
    Hi Angelina,

    Yes, this is very strange. The only other thing I can think of is your Refinement Target, which is part of the configuration in the Refinement Panel Web Part. Is this set correct?

    If this is also configured correctly, then I suggest that you contact Microsoft support for further assistance.

    Bella

  • Anonymous
    January 01, 2003
    Hi SyIMS,

    No, there is nothing special about the PictureWidth property. So from what you describe, you should get refiner values.

    I suggest that you contact Microsoft Support for further assistance.

    Bella

  • Anonymous
    January 01, 2003
    Hi, I am on a SharePoint 2013 Online E3 trial tenant, and on the search results page, I don't see an "Edit Page" option in Settings menu or somewhere else, so I can't get to the Refinement Web Part. Do you know if this option is not available for SP Online? Thanks

  • Anonymous
    January 01, 2003
    Hi KlompSY,

    Sorry, I don't know how you can fix this.
    I suggest you contact Microsoft support.

    Bella

  • Anonymous
    January 01, 2003
    Hi Angelina,

    That sounds very strange...
    Could it be that your items are not approved? That is, are your items in draft status?

    Bella

  • Anonymous
    January 01, 2003
    I'm not sure if my previous comment went through but I am having hard time getting this work. The early concepts is really throwing me for a loop. If I wanted to add a "custom site content type" to the "Result Type" list, what steps should ensure I do correctly (even though I'm sure I followed your effort here to the T)? I am having a heck of a time to get the results I want. (maybe that's the problem and it's not possible?) Essentially, I would like to have a custom content type included in the "Result Type" list (or the only option) ... or Content Types in general listed as "Result Types" when a user does a search ... Is it possible?

  • Anonymous
    January 01, 2003
    Hi Neena,

    Yes, you can use content type as a refiner. I describe how you can do this in this blog.
    Is there a particular thing you're having trouble with?

    Bella

  • Anonymous
    January 01, 2003
    Hi Uttam,

    I'm sorry, but I don't quite understand your question. Could you please give me some more details about what you're trying to achieve?

    Thanks,
    Bella

  • Anonymous
    January 01, 2003
    Hi Anne,

    You have to be a Site collection administrator to be able to add a mapping to a manage property.

    Bella

  • Anonymous
    January 01, 2003
    Hi Stephen,

    I'm not 100% sure I understand your scenario, but is it possible that a custom result source (https://technet.microsoft.com/library/dn186229.aspx) or custom query rule (https://technet.microsoft.com/library/jj871676.aspx) could do the trick?

    Bella

  • Anonymous
    November 20, 2013
    Thanks for this really helpful article. Have you come across any issues if you try and add your own refiner but leave the default refiners in place as well? When ever I do that nothing appears in the refiner section.

  • Anonymous
    November 21, 2013
    The comment has been removed

  • Anonymous
    November 22, 2013
    I have met issue with adding my own refiner. Problem was with using XML definition from MSDN site where is mistyping in MetadataThreshhold parameter name. It is still theremsdn.microsoft.com/.../ee819920(v=office.14).aspx

  • Anonymous
    November 22, 2013
    I think it was an issue on my dev server. I tried on our production environment and it worked fine.

  • Anonymous
    November 25, 2013
    OK, good to hear that it was resolved :-)

  • Anonymous
    November 25, 2013
    Hi Sergey, Thanks for letting us know about the spelling error. We’ll fix it in the next publishing round. The article you refer to applies to SharePoint 2010. Are you having difficulties with SharePoint 2013 as well? Bella

  • Anonymous
    November 28, 2013
    Can you explain SharePoint Search using search service ?

  • Anonymous
    November 28, 2013
    Hi Dhrumil, I’m not sure I understand your question. Could you please explain a bit more about what kind of information you are looking for? Bella

  • Anonymous
    December 27, 2013
    Pingback from How to add refiners to your search results page in SharePoint 2013 | Office 365 Singapore for Business - Win-Pro

  • Anonymous
    February 12, 2014
    Otra de las posibilidades de personalización que tenemos en las búsquedas es la de añadir más metadatos

  • Anonymous
    February 12, 2014
    Great series. I was curious why you mapped the Content Type to a refinable property when "Content Type" is already a managed property mapped to ows_ContentType. Is there an advantage to using a new refinable string?

  • Anonymous
    March 04, 2014
    This is a blog post in the series, “ Set up a Search Center in SharePoint 2013 ”. In the

  • Anonymous
    April 10, 2014
    Hello Bella,

    I have mapped the RefinableString01 to a crawled property as described above, then I re-index my library and perform a full crawl. When I edit the Refinement webpart, and select my refiner, I cannot see any sample values (the Alias I set is there, but not values are displayed).

    I tried to mapped as a different approach not only the "ows_ property" but also the "ows_q_", but nothing changed.

    I have also tried to make an existing Managed property Refinable (Yes - active) from the Central Administration, but the same thing happens.

    Can you please give me a hint of what is wrong here?

    Thank you in advance,
    Angelina

  • Anonymous
    April 11, 2014
    Hi Bella,

    I made sure that all the display templates, and pages are published but still no luck. Also I tried to create a new managed property from the Central Administration, re-index library and full crawl but still the same.

    I cannot imagine what is going wrong here.

    Thanks,
    Angelina

  • Anonymous
    April 11, 2014
    Hi Bella,

    All the items are approved. It is very strange since this value is displayed in the search results. When I am searching for the crawled property, I am getting three different values:

    1. ows_company
    2. ows_q_CHCS_Company
    3. Company

    I have tried with all of them, but still the refinement webpart returns nothing. Is there any other configuration that needs to be made?

    Thanks,
    Angelina

  • Anonymous
    May 18, 2014
    Hi Bella.. when we use multi-select refiner option, is there any way to show all available refiner values using a scroll bar or paging rather than limiting the number of refiners ?

  • Anonymous
    May 27, 2014
    Pingback from Customizing the Search Experience in SharePoint Online

  • Anonymous
    May 27, 2014
    Pingback from Customizing the Search Experience in SharePoint Online

  • Anonymous
    July 03, 2014
    The comment has been removed

  • Anonymous
    July 04, 2014
    Yes, Bella I'm pretty sure. I tried the following search : "PictureWidth>1024" and I get all pictures with a width greater than 1024. I also tried "PictureWidth<1024" and "PictureWidth:1024". Each time the results are correct.

    I think there is something special with this property. Just for testing I also tried to use PictureWidth to sort the results. In the query builder tool, in the sorting tab, I added this property and the search fails in the preview block. I get an error with no detail and a correlation id.

  • Anonymous
    July 24, 2014
    HI Syims,
    Nice post. I m using On-premise sp server 2013. I created a search results page with search results webpart having in it. Changed the query to filter based on value from query string parameter. Everything is working fine however search refinement is not working. When i click on first value on refinement, its working fine and if i click on another refinement value, nothing is displaying. In my query i am matching with querystring parameter. Is it a bug in SP server 2013 or i m doing something wrong?

  • Anonymous
    January 11, 2015
    The comment has been removed

  • Anonymous
    March 03, 2015
    Hi I am trying to add a search refinement panel which is set of all the result sources added,
    I have this in SharePoint 2010


    which listed my result sources in the left so that i can select any of the result source wanted. can i do something same in 2013 as well

  • Anonymous
    March 10, 2015
    Hi Bella,
    great post! Unfortunatly I have one big problem. The function "Add a Mapping" (On the Edit Managed Property page) is disabled. But I have Site Owner Permissions. Am I missing some permissions?

    Thanks!

  • Anonymous
    April 14, 2015
    Hi bella ,
    Is there any way to filter the values that i get by using "content type" . For example, if i need to show only specific content types in the refiner what should i do.Please help

  • Anonymous
    April 30, 2015
    Great article and have it all working perfectly. I wondered if its possible to set a filter on page load rather than show all by default?