Add Taxonomy filed in SharePoint search refinement web part

My first attempt to add taxonomy terms in a refinement web part on a classic search results page did not produce a human readable refiner so I decided to create a post about that. Following my intuition and what I tough is the way to make it work, I initially tried to add the auto generated by SharePoint search managed property owstaxIdTermSetProperty (ows_taxid_TermSetProperty) to the refinement web part. The display values in the refiner were the actual metadata with term Ids that is not really user readable.


After maybe 3 hour search on how to add taxonomy set to a refiner, I was able to find only one good post. This is why I created mine, so I can come back to it in case I ever forget about that.


How to add human readable terms in SharePoint search refinement web part


This is a brief tutorial with pictures on how to add existing term set to the refinement web part. In short, we will have to change the search schema of the site collection where the taxonomy terms are used in a form of a taxonomy fields populated with data in lists. We will have to map the human readable crawled property ows_TermSetProperty (not ows_taxid_TermSetProperty) to a RefinableString property in the site collection search schema. Again it is important to understand that the search schema of the site witch the taxonomy fields and data belongs to will be modified, not the Enterprise Search site schema or any other sitecolleciton search schema.


Change the search schema of the site collection that has the taxonomy data


Go to the site collection where the terms data resides. Go to the site settings


SharePoint site collection admin opened in browser

If you cannot find such button in the menu, the settings page URL you should access is https://your_tenant.sharepoint.com/sites/your_site/_layouts/15/settings.aspx

Navigate to search schema


SharePoint site collection admin opened in browser

Under the managed properties tab, use the managed property filter box and try to find RefinableString.


SharePoint site collection admin opened in browser

SharePoint will return list of refinable managed properties. More information on the Refinable properties can be found here.


SharePoint site collection admin opened in browser

Select refinable managed property that is not used, in my example is RefinableString00. The refinable will open in a new page at https://xx.sharepoint.com/sites/xx/_layouts/15/managedproperty.aspx?property=RefinableString00&level=sitecol

Navigate down to the "Mappings to crawled properties" section and add your taxonomy field there.


SharePoint site collection admin opened in browser

Use the find box to find your Taxonomy crawled property:


SharePoint site collection admin opened in browser

Go at the bottom of the page and to save. You can see that is it mapped when you go back to the screen with the mapped properties.


SharePoint site collection admin opened in browser

Change search refinement web part to show the taxonomy terms


Now, let's go to the search results page and configure the web part to use our RefinableString01 as topic refiner.

Go to your search results page, typically at ~sitecollection/pages/results.aspx.


SharePoint site collection admin opened in browser

Edit the refinement web part on the page.


SharePoint site collection admin opened in browser

Find and select the RefinableString01 managed property from the list.


SharePoint site collection admin opened in browser

If the data against the new mapping RefinableString01 is already indexed by SharePoint search. We will get that little nice preview:


SharePoint site collection admin opened in browser

Here is the final refiner result and my human readable taxonomy values.


SharePoint site collection admin opened in browser

Possibly the crawler has not yet indexed the data, in case you do not get the little preview.


SharePoint site collection admin opened in browser

Note, the refiners are dynamic, if there are not search results on the page showing content with the taxonomy included then the refiner would not be visible on the page as well.


Conclusion


It is not obvious how to map human readable taxonomy terms in SharePoint refinement web part. We have to modify the search schema of the sitecolleciton so we would need site collection admin rights to do that.


Useful URLs

  1. http://nikcharlebois.com/creating-custom-search-refiners-in-office-365-using-term-sets/
  2. https://blogs.msdn.microsoft.com/aatishblogs/2014/02/02/refiners-for-managed-metadata-columns-in-sharepoint-online/
  3. https://docs.microsoft.com/en-us/sharepoint/search/how-to-add-refiners-to-your-search-results-page
  4. https://blogs.technet.microsoft.com/sharepoint_made_easy/2013/03/19/step-by-step-configuration-to-add-custom-refiners-in-the-refinement-panel-of-search-results-page-for-sharepoint-online/
  5. https://docs.microsoft.com/en-us/sharepoint/search/manage-the-search-schema#default-unused-managed-properties