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 :
- 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.
- This property must be mapped with one of the Term Sets created in Managed Term Store.
- This property must be available as an additional Refiner for the People Search
Prerequisites:
- Managed Metadata Service Application Instance must be created & configured.
- User Profile Service Application Instance must be created & configured.
- Search Service Application Instance must be created & configured.
- Content Source must be created for User Profiles. Full crawl must be executed once.
- Search Center Site Collection must be created.
Now let’s see Custom Refiners in action.
Go to Central Administration = > Manage Service Application
https://howtodowithsharepoint.files.wordpress.com/2014/06/12.png?w=450&h=257
Select Managed Metadata Service Application Instance.
https://howtodowithsharepoint.files.wordpress.com/2014/06/210.png?w=450&h=212
SharePoint provides three Terms Sets Department, Job Title, Location which is available OOTB and mapped to User Profile Properties.
https://howtodowithsharepoint.files.wordpress.com/2014/06/38.png?w=450&h=191
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”.
https://howtodowithsharepoint.files.wordpress.com/2014/06/41.png?w=450&h=165
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 = > Manage Service Application
Select User Profile Service Application Instance
https://howtodowithsharepoint.files.wordpress.com/2014/06/51.png?w=450&h=293
Go to “Manage User Properties”
https://howtodowithsharepoint.files.wordpress.com/2014/06/61.png?w=450&h=189
Click “New Property”
https://howtodowithsharepoint.files.wordpress.com/2014/06/71.png?w=450&h=75
Enter Name, Display Name, Type and Choose Term Set as shown below:
https://howtodowithsharepoint.files.wordpress.com/2014/06/81.png?w=450&h=431
Scroll down and make sure “Default Privacy Settings” must be set to “Everyone” else Search Crawler won’t be able to crawl this property.
https://howtodowithsharepoint.files.wordpress.com/2014/06/91.png?w=348&h=450
Click OK.
This will create a new User Property under Custom Property Section as shown below.
https://howtodowithsharepoint.files.wordpress.com/2014/06/101.png?w=450&h=330
Now go to “Manage User Profiles” to modify the User Property Page for the User.
https://howtodowithsharepoint.files.wordpress.com/2014/06/111.png?w=450&h=186
Find the User and Edit its profile by selecting “Edit My Profile” from ECB as shown below
https://howtodowithsharepoint.files.wordpress.com/2014/06/121.png?w=450&h=159
Scroll down and locate the “Last Company” property.
Enter the company name using “Term Picker” as shown below
https://howtodowithsharepoint.files.wordpress.com/2014/06/131.png?w=450&h=62
https://howtodowithsharepoint.files.wordpress.com/2014/06/141.png?w=450&h=320
Save and Close the User Property Page by clicking the “Save an Close” button.
https://howtodowithsharepoint.files.wordpress.com/2014/06/151.png?w=450&h=77
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 = > Manage Service Application
Select Search Service Application Instance
https://howtodowithsharepoint.files.wordpress.com/2014/06/161.png?w=450&h=201
Click on “Content Sources” to open “Manage Content Sources” Page
https://howtodowithsharepoint.files.wordpress.com/2014/06/171.png?w=450&h=237
Choose “People Search” Content Source and click “Start Full Crawl” using ECB as shown below:
https://howtodowithsharepoint.files.wordpress.com/2014/06/181.png?w=450&h=294
Wait till the Crawl Status is “Idle”.
https://howtodowithsharepoint.files.wordpress.com/2014/06/191.png?w=450&h=197
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:
https://howtodowithsharepoint.files.wordpress.com/2014/06/201.png?w=450&h=365
We can easily refine the incoming results by using “Last Company” Refiner as shown below:
https://howtodowithsharepoint.files.wordpress.com/2014/06/211.png?w=450&h=281
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.
Hope this will help someone in need.