Refiners for Managed Metadata Columns in SharePoint Online
In SharePoint 2013, a new search web part named Refinement is introduced, which helps in narrowing down the search results. It contains a set of refiners using which one can further narrow down the search results. In this article, we will look into how managed metadata columns can be used as refiners.
Lets assume that, we have a document library which have the following managed metadata columns. The library has few documents in it with the columns having their corresponding values.
When search performs full crawl on this library, it generates a crawled property for each of the managed metadata columns and then maps it to a managed property. Crawled property for site columns are always prefixed with ows_ and the spaces in site column name are encoded as _x0020_ .
Click on search in 'SharePoint admin center' and then click on 'Search Schema' to work with managed and crawled properties.
Lets, look at one of the column, say 'Business Unit'. SharePoint search generates the following crawled properties for it.
Crawled Property Name Mapped To Managed Property
ows_Business_x0020_Unit - (Not Mapped)
ows_taxId_Business_x0020_Unit - owstaxIdBusinessx0020xUnit
The crawled property of our interest here is ows_Business_x0020_Unit since it returns one of the values (text) for the column 'Business Unit' like 'Finance' and 'Marketing'.
However, it is not mapped to any managed property by default. So, in order to use this crawled property, we will have to map it to a managed property. Now, there are a set managed properties which are available as a refiner but are not mapped to any crawled property. We will use one of them for our purpose. Please find them below in the table.
Managed Property | Data Type |
RefinableDate00 - RefinableDate19 | Date |
RefinableDecimal00 - RefinableDecimal09 | Decimal |
RefinableDouble00 - RefinableDouble09 | Double |
RefinableInt00 - RefinableInt49 | Integer |
RefinableString00 - RefinableString99 | String |
The data type denotes the type of value the managed property can map to.
Since, column 'Business Unit' has values of type text (string), so we will map its crawled property - ows_Business_x0020_Unit to one of the RefinableString managed property, say RefinableString04.
Similarly, we do mapping for remaining columns.
Column Name Crawled Property Managed Property
1. Business Unit - ows_Business_x0020_Unit - RefinableString04
2. Community - ows_Community - RefinableString00
3. Country - ows_Country - RefinableString03
4. Document Status - ows_Document_x0020_Status - RefinableString05
5. Languages - ows_Languages - RefinableString01
6. Technology - ows_Technology - RefinableString02
Remember to mark each of these managed properties as - Queryable, Retrievable and most importantly Refinable in the Edit Manage Property page. Lastly, don't forget to check the Allow multiple values checkbox.
After creating above mappings, add a search refinement panel in the search results page. Edit the refinement web part and then click on 'Choose Refiners... ' button.
It will open a pop-up as shown below, in which Add the above managed properties from the list of 'Available refiners' into the list of 'Selected refiners' . Mention a 'Display Name' and select a 'Display template' for each of the selected refiner.
Lets say for column 'Business Unit', we have refiner RefinableString04. we give 'Business Unit' as its 'Display Name' and select 'Multi-valued Refinement Item' as its 'Display template' .
After saving changes, lets do a search for all documents. We get search results with refiners in our update refinement panel as shown below.
As you can see, a refiner for each managed metadata column is now added in the refinement panel. Using it, we can further refine the search results.
Comments
- Anonymous
February 03, 2014
Hi,I followed your instructions but nothing happens. I posted a discussion at the Office 365 Community:community.office365.com/.../655783.aspxRegards,Jasper - Anonymous
February 04, 2014
@Jasper : If you are able to see the crawled properties then did you created mappings with the refinable managed properties? - Anonymous
February 21, 2014
Have you tried this with hierarchical data? I have noticed that the display properties of the field lead to an inconsistent presentation. If "Display Full path" is selected I see "Term:Term:Term" but if I select "Display Term" I only see "Term" consequently I'll get two refiners for the same Term depending on the Column display settings. (Even though the owstaxIdColumnName field data is identical.) Ideally a hierarchical refiner control would be best. - Anonymous
March 10, 2014
How do we get the custom managed metadata value in the search display template. In the search display template metadata column populating with guid ,, ("GP0|#d43f1794-54c5-4b31-b37d-2bbc332adc0f L0|#0d43f1794-54c5-4b31-b37d-2bbc332adc0f|Construction GTSet|#6ecea20f-b230-49c9-bec7-15173827f0fb" ;) .. Is there any easy way retrieve only value.. Thanks!! - Anonymous
March 11, 2014
got resolve - by using same "RefinableString04" mapped property in custom search display template returns correct metadata terms/values. Thanks for this post - got lots of idea after read this.. - Anonymous
April 21, 2014
@Anand, I have the same problem as you did with the correct metadata terms/values not showing. I just don't understand how you resolved it. Could you please explain it a bit more.Thanks in advance. - Anonymous
June 09, 2014
@klompSY , I am with youin my /searchcenter site collection I edit my custom display template for People searchI have added 'RefinableString00':'RefinableString00' to my Custom Display template thenvar uBusiness = Srch.U.getHighlightedProperty(id, ctx.CurrentItem, "RefinableString00");
Publish minor version ( since I don't want my users to see this just yet)You need to check the Results Type in the site settings as this may ask you to update as it has detected a change to your display template ( tip from another blogger Steve Mann) - just click on the update link.Still I don't see anything under each user I display ... and they all have this property.if (!$isEmptyString(uBusiness)) { uBusiness = ctx.CurrentItem.RefinableString00;}
- Anonymous
June 10, 2014
Very good article i read so far related to managed and crawled property.Can you also explain what is the procedure is we want to change the column name in the library(the column is used as a refiner field on the search page)?Where all we need to make the changes with reference to managed and crawled properties?Thanks in advance. - Anonymous
February 11, 2015
I created a document set library. Added my columns. Shared them. Made sure the managed content was checked yes. It's checked to be searchable.I went to the Schema from my site rather than Central Admin. Found my crawled properties and mapped them to RefineableString01 etc. They're checked to be refineable, sortable, etc.I have waited for a day and still have no sample values. Therefore no refiners. I've double checked. The properties are mapped. My site is in the Cloud not on prem. Any help would be appreciated. I unfortunately have a deadline of this Friday. - Anonymous
February 16, 2015
All those having Trouble getting the refiners to show up:you Need to do a full crawl on your data source. Only after a full crawl the new refiners will show up. - Anonymous
March 09, 2015
The comment has been removed - Anonymous
April 02, 2015
Nice Article to get the understating of how refiners impact the search result and will help to improve search result. - Anonymous
April 22, 2015
Does any one have idea - how to add the managed metadata control in the Refinement Panel - I have Big Term set category. which is not feasible to show as is in the refinement panel with Mapped Property.Please share the thought on it.Thanks - Anonymous
September 02, 2015
I followed these steps, but I can't find any values for the property when I choose my refiner. Not sure what I am doing wrong.