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.
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:
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 is a set of managed properties available for the 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.
- 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 the 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 the “Choose Refiners…” button in the web part properties.
- From the list of “Available Refiners,” Select “RefineableString05” (or whatever managed property you mapped in the previous step) and click on the “Add” button.
- 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 a 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 the refinement panel (which is obvious!)
Here is the Microsoft documentation on adding refiners to refinement panel in SharePoint search results: https://docs.microsoft.com/en-us/SharePoint/search/how-to-add-refiners-to-your-search-results-page