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 –
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.