Creating Custom Search Refiners in Office 365 using Term Sets

In this article we will cover how you can, in Office 365, create a custom column on a Document Library and use its values to define additional refiners in your search results. The idea for this blog post came after a client engagement of mine, where the organization I was working with wanted to tag their documents with a new managed metadata column named “Branch” which contained the name of the branch within their organization that was the owner of the document.

Step 1 – Define your Term Set
a) Navigate to the Office 365 Admin Center
Waffle

b) Navigate to the SharePoint Online Admin Center
SPAdminCenter

c) Navigate to the Term Store page
termstore

d) Click on the Taxonomy Home, and select New Group
NewGroup

e) Name your new group “Organization”
OrgTermMMS

f) Create a new term set and name it “Branches”
NewTermSet

g) Under the newly created “Branches” term set, enter several terms that would represent the names of the various branches in your organization
Branches

Step 2 – Create the new column in your Document Library
a) Create a new document library in any of your SharePoint Online sites and name it “Important Documents”
ImportantDocs

b) From the View All Site Contents page, click on the “…” icon for the newly created document library and click on Settings
ImpDocsSettings

c) Scroll down on the document library settings page and click on the “Create column” link
Createcolumn

d) Name the new column “Branch” and set its type to “Managed Metadata”
BranchField

e) Scroll down to the “Term Set Settings” section on the new column page. In the Term Picker window, navigate to the “Branches” term set we created at step 1-f above. Select it, and click ok to create the new column.
SelectFieldMMS

f) Upload a new document into the newly created “Important Documents” Library, and set it “Branch” value. In my case I assigned it the value “Finance”.
SetBranch

Step 3 – Wait for the SharePoint Online Search to pick up our value
a) The SharePoint Online Search engine is set to Continuous crawl by default. The new column should be picked up within the next 15 to 60 minutes, and since our column is of type “Managed Metadata”, the search engine will automatically create a managed property and associate it with the automaticaly generated crawled property. Wait for the indexer to pick up our new column.

4 – Map the “Branch” Crawled Property to a Refinable Managed Property
a) Navigate back to the SharePoint Online Admin Center (see step 1-b above);
b) Navigate to the Search Schema page
ManageSchema
c) Confirm that the Crawled property was automatically created. In the top navigation bar, click on the “Crawled Properties” link.
CarledPropButton
d) In the Filters section, within the “Crawled properties” textbox, type in “Branch” and click on the green arrow button. You should see that you have at least 3 results coming back. If you do, then that means that the search indexer managed to automatically crawl your new column.
crawledresults
e) In the top navigation, click on the “Managed Properties” link
ManagedPropButton
f) In the ‘Managed property” textbox enter “RefinableString00” and click on the green arrow button. You should have only one result back
refinablestringfound
g) In this article, we will be re-using a predefined refinable managed property to map to our newly created crawled property. By default, SharePoint online defined 100 refinable “text” properties (RefinableString00 to RefinableString99). These are not mapped to any crawled properties by default.
Click on the arrow beside the RefinableString00 result, and select “Edit/Map Property”
EditMapProp
h) On the next page, scroll down to the “Mappings to crawled properties” section near the bottom. Click on the “Add Mapping” button.
AddMapping
i) We now need to map it to our automatically created crawled property. In the “Search for a crawled property name:” textbox enter “Branch” and click on the “Find” button. The 3 results we got at step 4-d should be returned
3results
j) The property we are interested in here is the one that is formatted like “ows_” (in my case ows_Branch). Select the property from the list by clicking on it, scroll to the bottom of the dialog window and click on “OK”.
selectCrawledProper
k) Once the dialog Windows closes, scroll down to the bottom of the page and click on “OK”. We now have a refinable managed property that is mapped to our crawled property Branch. We are now ready to go and use this refinable property as a refiner on our search page.
5 – Modify the Search Results Page to Include our Refiner
a) Navigate back to your search center. Please note that page to be editable, you need to create your own Enterprise Search center. By default SharePoint Online creates one at https://.SharePoint.com/Search. If you navigate to your search page and don’t see the option to edit the page (assuming you should have the proper rights to edit it) it is most likely because you are trying to edit the default SharePoint OSSSearch page. This page is not customizable, and you should make sure you have a proper Enterprise Search site created. To figure out if the search page you are looking at is the OSSSearch page, simply have a look at the URL. If it looks like the following: https:.sharepoint.com/_layouts/15/osssearchresults.aspx, then you search is not pointing to a customized Search center and you will not be able to edit that page.

Assuming you are all good to go and have created your own Enterprise search center, navigate to the search result page, and edit the page.
EditPage
b) in the left web part zone, find the the “Refiner” web part. Put your mouse over the top right corner of the web part, click on the downward arrow icon and select “Edit Web Part” from the menu.
EditWebPart
c) The web part property panel will appear on the right hand side of the page. From there, take a look at the “Properties for Search Refinement” section. Make sure the “Choose refiners in the Web Part” radio button is selected and click on the “Choose Refiners…” button.
chooserefiner
d) From the list of available Managed properties in the left column, find the “RefinableString00” property we just mapped to our “Branch” column. Click on it to select it in the left column and click on the “Add” button to have it added to the list of active refiners in the right column.
PickedRefiner
e) In the Configuration section at the bottom of the dialog window, enter a friendly display name for the property (otheriwse it will show up as RefinableString00 to the users). In the “Display Name” textbox, enter your friendly name (in my case “Branch”).
DisplayNameforRefinable
f) Scroll down to the bottom of the current dialog box and click on the “OK” button.
g) In the Web Part properties panel on the right, click on the “OK” button.
WPOk
h) In the ribbon at the top of the page, click on the “Save” button.
SavePageAftermodif
6 – Perform a Search
a) After completing section 5 above and clicking the “Save” button on the Search Results page, you should be back on the results page. In the Search textbox at the top of the page, enter a keyword that will allow you to retrieve the document we uploaded at step 2-f. In my case, I will search for keyword “Financial”. enter the search keyword in the textbox and click on the maginfying glass icon to the right of it.
FinancialSearch
b) Once the results come back you should be able to see your newly added refiner in the left column
searchresultfound

Voilà! We managed to create a new column and configure it as a refiner for users, improving their search experience and allowing them to easily find the documents they were looking for!

Microsoft Premier Field Engineer – SharePoint

Leave a Comment

Your email address will not be published. Required fields are marked *

*
*