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
b) Navigate to the SharePoint Online Admin Center
c) Navigate to the Term Store page
d) Click on the Taxonomy Home, and select New Group
e) Name your new group “Organization”
f) Create a new term set and name it “Branches”
g) Under the newly created “Branches” term set, enter several terms that would represent the names of the various branches in your organization
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”
b) From the View All Site Contents page, click on the “…” icon for the newly created document library and click on Settings
c) Scroll down on the document library settings page and click on the “Create column” link
d) Name the new column “Branch” and set its type to “Managed Metadata”
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.
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”.
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
c) Confirm that the Crawled property was automatically created. In the top navigation bar, click on the “Crawled Properties” link.
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.
e) In the top navigation, click on the “Managed Properties” link
f) In the ‘Managed property” textbox enter “RefinableString00” and click on the green arrow button. You should have only one result back
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”
h) On the next page, scroll down to the “Mappings to crawled properties” section near the bottom. Click on the “Add Mapping” button.
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
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”.
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.
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.
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.
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.
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”).
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.
h) In the ribbon at the top of the page, click on the “Save” button.
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.
b) Once the results come back you should be able to see your newly added refiner in the left column
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!