As noted right in the beginning of the previous post, “Search is an essential component of any well constructed business management system and/or LOB application in SharePoint [and Office 365]”. We’ll follow along a few SharePoint Search oriented activities for the next couple of posts. In this post, we’ll see how to use Search Refiners to narrow down Search Results on sales contracts in their Contract Lifecycle Management (CLM) site by Sales Contract Stage and Customer Name. Before that, let’s take a moment to get oriented with a bit of SharePoint Search terminology.
Again, referring to the previous post, we saw how the Sales team used a workflow to push the Sales Contract Title property into documents’ hidden Title property. This was done so that Search results would render this most relevant value representing the name of a document:
But, why/how is Title being rendered by SharePoint Search in the results and the Word Document Hover Panel as shown in the example above?
Now, “Title” specifically happens to be a special field to SharePoint, but the answer to the question is still fundamentally as follows. Title is being picked-up, that is “Indexed“, by SharePoint Search because it has been explicitly defined as a “Crawled Property” in the SharePoint Search Schema. Furthermore, it is available to be rendered in fundamental Search components such as Search Results and the Word Document Hover Panel because that Crawled Property has been promoted to a “Managed Property“. Let’s break that down a bit further:
- Many pieces of content in lists and documents are consumed and made available to SharePoint Search. This content is said to be Indexed in Search.
- Some of that content is given priority in Search Results after it is promoted in the Search Schema to a Crawled Property.
- That Crawled Property can then be turned into a SharePoint Search super-citizen, and made available to special Search tools, when it is yet further promoted to a Managed Property.
Above, you see that life as a super citizen wherein Title shows up in the Word Document Hover Panel, and on the left of the screen, “Result Type”, “Author”, and “Modified date” are showing-up in the left hand SharePoint Search tools called “Refiners“. You can click, show/hide, use slider bars, and interact with these values in the refiner tools to quickly filter the Search Results that are returned from the query you enter in the Search Box. These fields are all setup as Managed Properties in SharePoint by default…out-of-the-box. Okay, so how will Sales go about turning Sales Contract Stage and Customer Name into Crawled Properties and Mapped Properties?
Well, this will be yet another win garnered by having used Site Columns as part of the Information Architecture policies: Site Columns are automatically promoted to Crawled Properties in SharePoint, and in many cases they are also further promoted into Managed Properties. Here is the Sales Team taking a look at their Search Schema’s Crawled Properties. If you’ve been following along , your Search Schema should look nearly the same. *Take note that the video shows Sales going to Site Collection level settings:
What you may have noticed is that some of the Crawled Properties were already mapped to Managed Properties, while others weren’t. There are a lot of technical reasons as to why, that are out of the scope of this post, but suffice to write, it has to do with the data type, settings, and definitions of the Site Columns. What is true, regardless, is that Sales needs to map Sales Contract Stage and Customer Name to special pre-configured refinable Managed Properties in order for these Crawled Properties to be available for the SharePoint Search refiner web parts and refined queries.
Setting SharePoint Search Refiner Managed Properties:
As an independent exercise, you should also map “Expire Date” to RefinableDate00 before continuing:
Now, let’s watch how to use these refiners. And, please note, it is going to take a long time for SharePoint Online to pick-up the new managed property mapping and populate it with values from all of the sales contracts. Unfortunately, I’ve seen this take upwards of 48 hours. But, once it’s done, the continuous updating of values driven from the addition of new content occurs quickly…around 1-2 hours after the content is added from what I’ve observed in several SharePoint Online and O365 tenants. You’ve already seen Sales update an existing page and add web parts. Here, you’ll see the team create a new page and use a yet unseen Web Part: the Content Search Web Part (a.k.a. CSWP).
There’s a lot of moving parts here, including creating custom queries. Just take it at face value for now; the concept of writing custom queries is going to be covered extensively in upcoming posts.
After the dialog loads, restrict the results to just “Sales Contracts”:
Looking at the default results, the visual representation is not really applicable, and there aren’t enough results being returned (only 3):
So, makes some changes to the CSWP properties.
A couple of notes:
- Titles and Sales Contract Titles are showing up as mixed results because SharePoint Search hasn’t finished indexing all content after running the OnCreated Workflow demonstrated in the previous post.
- The date stamp for RefinableDate00 (i.e. Expire Date) has time included. That’s not optimal. We’ll see how to remove the time value in a future post.
Almost there…let’s see how to make two advanced updates to the CSWP query.
Setting SharePoint Search Advanced Mode Properties:
Click the “Change query” button on the CSWP properties dialog, and click the “Switch to Advanced Mode” label under “Basics”:
Now, change your query to the following…noting that your “ContentTypeId” value will be different in your system. Everything else should be identical if you’re following along step-by-step. This query is pulling in anything under the current site, with the content type matching that of “Sales Contracts” where the Expire Date (which is mapped to RefinableDate00) is greater than or equal to today:
Using the SharePoint Search Refiner Managed Property to Sort:
This is being done because sales doesn’t want their quick search to include any sales contracts that are already expired. Finally, switch to the “Sorting” tab, which is not available in Basic mode, and sort by the Expire Date in Ascending order so that Sales Contracts which expire the soonest will appear at the top of the search results.
Now, we are seeing unexpired Sales Contracts that are sorted by their upcoming expiration date:
Adding the SharePoint Search Refiner Web Part:
On to adding the quick refiner controls that will let users filter results by Customer Name and Sales Contract Stage with the click of a button. As noted above, some refiner values may not be available until you wait (potentially 24 or more hours) for the first full crawl and population of the values to be completed by SharePoint Search.
Finally, a simple clean-up to the page and the Current Navigation links:
There’s more to come as as you advance your knowledge of how to effectively use SharePoint Search to drive business management and business process management.