Sharepoint 2013: How To Develop Custom Search Refiners

There could be scenarios where we need to have additional Search Refiners apart from the refiners provided by SharePoint OOTB.

Business Scenario

In this article we are going to take care of a scenario where :

  1. We need to add one additional property to the User’s Profile with the name “Last Company”. This property will contain the name of the User’s previous organization.

  2. This property must be mapped with one of the Term Sets created in Managed Term Store.

  3. This property must be available as an additional Refiner for the People Search.

Prerequisites

  1. Managed Metadata Service Application Instance must be created & configured.

  2. User Profile Service Application Instance must be created & configured.

  3. Search Service Application Instance must be created & configured.

  4. Content Source must be created for User Profiles. Full crawl must be executed once.

  5. Search Center Site Collection must be created.

Now let’s see Custom Refiners in action.

Go to Central Administration, then Manage service applications,

Central Administration

Select Managed Metadata Service Application Instance.

Service

SharePoint provides three Terms Sets Department, Job Title, Location which is available OOTB and mapped to User Profile Properties.

Properties

Now let’s create a new Term Group “Companies”.

Under “Companies” create a new Term Set “My Past Companies”.

Under “My Past Companies” create new Terms as shown below. Each term should represent a single company that can be selected from within User’s Property Page using “Terms Picker”.

Terms Picker

With this we are done with the Managed Term Store Configuration.

Now it is time to create a new User Property “Last Company,” which is mapped to the Term Set “My Past Companies”.

Go to Central Administration, then Manage Service Application,

Select User Profile Service Application Instance,

Instance

Go to “Manage User Properties”,

Properties

Click “New Property”,

New Property

Enter Name, Display Name, Type and Choose Term Set as shown below:

choose

Scroll down and make sure “Default Privacy Setting” must be set to “Everyone” else Search Crawler won’t be able to crawl this property.

property

Click OK.

This will create a new User Property under Custom Property Section as shown below.

create

Now Go to “Manage User Profiles” to modify the User Property Page for the User.

Manage User Profiles

Find the User and Edit the profile by selecting “Edit My Profile” from ECB as shown below,

Edit My Profile

Scroll down and locate the “Last Company” property.

Enter the company name using “Term Picker” as shown below,

Last Company

select

Save and Close the User Property Page by clicking the “Save an Close” button.

save

With this we are all done with the creation and configuration of the Custom User Property.

Now it is time to trigger the Crawl on User Profiles so that this new property gets crawled and available for the search queries.

Go to Central Administration, then Manage Service Application,

Select Search Service Application Instance,

Instance

Click on “Content Sources” to open “Manage Content Sources” Page,

Manage Content Sources

Choose “People Search” Content Source and click “Start Full Crawl” using ECB as shown below:

People Search

Wait till the Crawl Status is “Idle”.

Idle

Go to Search Center and Click on “People” Vertical.

Enter Search Term and Click Find Icon,

As soon as the Search Results appear we can notice a new Refiner “Last Company” available on the Refiner Panel as shown below:

Last Company

We can easily refine the incoming results by using “Last Company” Refiner as shown below:

Last Company

By this simple walkthrough we can conclude that the capability of creating new Refiners is quite powerful and gives us enormous power to create different kind of refiners based on the incoming result sets.

I hope this will help someone in need.

Read more articles on SharePoint: