SharePoint Online: How to Add a Custom Refiner to Refinement Panel in Search Results?

Requirement: Create Search Refiners in SharePoint Online.

How to Add a Custom Column in Search Refiner in SharePoint Online?
Refinement Web Part in SharePoint Online search results page helps us to narrow down the search results. By default, the refinement panel has Result type, Author and Modified Date columns in it.
sharepoint online create search refiners

In my case, We have a document library with "IC Number" and "Project Name" Columns, which I would like to show in the Refinement Panel on the Search Results. Make sure your document library is already crawled by search, so that we have crawled properties for metadata columns in the document library created. Here are the steps to add a custom refiner to SharePoint Online Search results:

In Short: Map a crawled property of list column to any one of the Built-it "RefinableString..." managed property and Edit the Refinement web part in Search Results page to include the Metadata property in Refiners!

Step 1: Map Crawled Property with Refiner Managed Property:
SharePoint Online search refiners are based on managed properties from the search index. As SharePoint Online doesn't allow us to create a new Managed Property as "Refineable", we need to use the "Default unused managed properties" which comes with SharePoint Online and map any crawled property with these managed properties to make them as refiners. There are set of managed properties available for refinement panel in different data types, E.g. RefinableString00 to RefinableString199.
  • Go to SharePoint Online Site Collection >> Settings >> Click on "Search Schema" under site collection Administration.
  • Search for a Managed property either by entering its name for using paging. In my case I entered "RefinableString05" >> Edit the property (Make sure its not mapped with any existing crawled properties)
  • Provide an Alias name to the property (This is optional, but helps you to identify the column quickly!)
  • Scroll down and under "Mappings to crawled properties " section, click on "Add a Mapping" button. In the Crawled property popup page, Search for crawled property name. In my case, I entered "ICNumber" and two crawled properties were found: ows_q_USER_ICNumber and ows_ICNumber. Select the one starts with "Ows_" prefix.sharepoint online search refiner web part
  • Click OK to add  Mappings to crawled property field.
You may have to repeat this procedure to map a crawled property to a refinable managed property for all refiners. You can remove/Move existing refiners.

Re-Index the Document Library:
Go to Library Settings >> Advanced Settings >> Click on "ReIndex Document library" button and confirm the prompt.

Step 2: Edit Search Results page and Add Refiner columns:
The next step is to add the managed property we configured to the search refinement web part. Here is how:
  • Go to your Search Center site (I'm assuming you have one created already!)
  • Navigate to the search results page by typing any keyword in search box. In my case its "Results.aspx" page
  • Click on Settings >> Choose "Edit page"
  • Edit the Refinement Panel web Part by clicking the Web Part Menu, and then click Edit Web Part >> Click on "Choose Refiners…" button in the web part properties.sharepoint online search add refiners
  • From the list of "Available Refiners" Select "RefineableString05" (or whatever managed property you mapped in previous step) and click on "Add" button.sharepoint online custom search refiners
  • Set properties for the refiner such as "Display Name", etc.
  • Click "Ok" on the refiner web part Save and Close the Page
Now when you perform the Search on left Refinement Panel you will see new Refiners "Project Name" and "IC Number".

SharePoint Online Search Refiners Not Showing?
Well, it takes few hours for the SharePoint Online search engine to full crawl and index (In my case, it took 6 Hours!). Also, You need to have data present in the mapped columns in order to list them in refinement panel (which is obvious!)

Here is the Microsoft documentation on adding refiners to refinement panel in SharePoint search results:

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.