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

Navigate to SharePoint site collection settings

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 settings manu, navigate to the search schema page

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

use the managed property filter box to find refinable string

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

SharePoint returns list of refinable managed properties

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.

add a mapping SharePoint site collection search schema

Use the find box to find your Taxonomy crawled property:

crawled property selection popup window

Add only the ows_TermSetProperty to the mappings.

add ows_TermSetProperty to the mappings

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.

Shows in the mapped crawled properties column in the managed properties table

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 search results page

Edit the refinement web part on the page.

edit the refinement web part on SharePoint search results page

Find and select the RefinableString01 managed property from the list.

Choose refiners to show in the refiner web partresults page got new taxonomy refiner

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

preview of the refiner from the SharePoint search refinement web part

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

taxonomy property refiner in SharePoint search result page

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

no preview when select refineblestring in the refinement web part

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

  • http://nikcharlebois.com/creating-custom-search-refiners-in-office-365-using-term-sets/
  • https://blogs.msdn.microsoft.com/aatishblogs/2014/02/02/refiners-for-managed-metadata-columns-in-sharepoint-online/
  • https://docs.microsoft.com/en-us/sharepoint/search/how-to-add-refiners-to-your-search-results-page
  • 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/
  • https://docs.microsoft.com/en-us/sharepoint/search/manage-the-search-schema#default-unused-managed-properties
Posted on

Tags: SharePoint Search, SharePoint Online, Office 365, Taxonomy, Term Set, Managed Metadata, Managed Metadata Service, MMD, Refiner, Refinement Web part, Classic site, Enterprise search center

Comments