For many if not most end-users, searching in SharePoint Online is limited to the familiar ‘out of the box’ (OOTB) search bar.
Searches at the site level return five standard verticals as shown below: All, Files, Sites, News, Images.
Both the default ‘All’ and the ‘Files’ verticals includes the option to filter by File type (e.g., PDF) and Last Modified only.
In addition to these verticals, end-users may choose to ‘navigate’ up to search across the entire Organization or, if the site is linked with a hub, to the site, the hub, to another hub (if one exists), and then the Organization as shown in the example below.
But what if you want to filter by metadata columns that have been added to a specific site?
This post explains how to create one or more new search verticals that include one or more filters for existing and added metadata on a single SharePoint site, as shown in the screenshot below.
The basics first
To understand how to create search filters, it is important to understand the following details:
- All existing and added metadata columns are created as crawled properties. This means that the content is crawled for search purposes. Crawled properties are assigned a slightly different name with the prefix ‘ows_’. For example, the column ‘Document Type’ becomes ‘ows_Document_x0020_Type’ as a crawled property. Note that site columns based on managed metadata have two crawled properties, an additional one with the prefix ‘ows_taxid_’. This additional property can be ignored for the purpose of this post.
- All crawled properties become managed properties. This means that the metadata values in the column are extracted into the search engine and allow the value to be searched. Managed properties are also assigned a different name, with the suffix OWSCHCS. For example, ‘Document Type’ is assigned the name ‘DocumentTypeOWSCHCS’.
See this article ‘How Do Site Columns Become Managed Properties – Thus Available for Search‘ on the Microsoft Learn site for further information about how site columns become crawled and then managed properties.
A managed property must be refinable to allow the metadata values to be filtered in a search vertical. However, neither crawled nor managed properties are refinable, as can be seen in the DocumentTypeOWSCHCS managed property details below.
How do make a managed property refinable?
The process of making a managing property refinable on a specific SharePoint site (which can include a hub site with multiple sites linked to it) is achieved through the ‘Search Schema’ section of the Site Collection Administration area of a SharePoint site. You must be a site collection administrator to modify any element in this section.
The ‘Search insights and configuration’ section highlight above is where the vertical and filters will be created after the managed properties have been mapped to a refinable managed property.
Step 1 – Access the Search Schema section in Site Settings > Site Collection Administration
The Search Schema section opens to the Managed Properties section (/_layouts/15/listmanagedproperties.aspx?level=sitecol) that lists the first 50 of hundreds of managed properties.
Any added site columns will appear in this list (a) without spaces if the column name had more than one word and (b) with ‘OWSCHCS’ as the suffix. These managed properties cannot be used in search filters as they are not refinable.
Step 2 – Find the crawled property for added site columns
Click on ‘Crawled Properties’ section of Search Schema (/_layouts/15/listcrawledproperties.aspx?level=sitecol). This section will list crawled properties and show if they are mapped to a property.
Enter a word from the added site column name in the ‘Crawled properties’ search box. If the column had more than one word, search for only one of the words as the crawled property name will be slightly different with ‘ows_’ as the prefix.
- For example, if the site column name was ‘Document Type’, search for either ‘Document’ or ‘Type’. The crawled property name will be something like ‘ows_Document_x0020_Type’.
- If the site column was based on managed metadata, there will be two crawled properties, one with ‘ows_taxid_’ as the prefix. You can ignore this one for the purpose of this post.
The added site column should show that it is not mapped to any property.
The next step is to map the crawled property to a RefinableString. This step is what makes the column refinable for search filters.
Step 3 – Map the crawled property/ies to the refinable string/s (repeat process)
Return to the ‘Managed properties’ section of the Search Schema page.
The type of site column that was added (e.g., Single Line of Text, Choice, Number etc) will determine the type of refinable managed property that is required. In the example used for this post, ‘Document Type’ was a ‘Choice’ column.
For reference, every SharePoint site includes over 480 empty refinable managed properties that can be used to map crawled properties. They include the following types:
- Date and time-based properties: RefinableDate (00 – 19), RefinableDateFirst (00 – 04), RefinableDateInvariant (00 – 01), RefinableDateSingle (00 – 04)
- Decimals: RefinableDecimal (00 – 09)
- Double Precision Float: RefinableDouble (00 – 09)
- Integers: RefinableInt (00 – 49), RefinableIntFirst (00 – 04)
- Text: RefinableString (00 – 219), RefinableStringFirst (00 – 39), RefinableStringLn (00 – 09), RefinableStringWbOff (00 – 49), RefinableStringWbOffFirst (00 – 49)
- Yes/No: RefinableYesNo (00 – 04)
If the added site column was a choice or managed metadata type (e.g., with text choices), search for ‘RefinableString’ as shown in the screenshot below. Multiple refinable strings will be visible, many or most of which have nothing listed under the ‘Mapped Crawled Properties’ column. Double click on the refinable string to be used. The selection itself is not important, it is more important to note down which one is used.
The refinable string will now open as shown (in part) in the screenshot below.
Further down in the options, the ‘Alias’ option will be blank. It is a good idea to add a name to this (with no spaces) to ‘connect’ it back to the original site column name.
You will see that the managed property is refinable and also sortable; neither of these options can be changed here.
The last option is where the crawled property will be mapped. Click on ‘Add a Mapping’.
Search for the site column word in the crawled property selection box. In the example below ‘document’ found a range of crawled properties but the one to be used here is ‘ows_Document_x0020_Type’. Select the option required then click OK to save.
Repeat the mapping process for each added site column/crawled property that will be required in the search filter.
- NOTE: The above process can also be completed on a hub site that has one or more associated sites. From the hub site, select the crawled properties that were added on the associated sites. When search filters are created on the hub site (as described below), a search will offer (under the relevant vertical) the ability to filter by those columns.
Step 4 – Confirm the outcome
The Managed Properties list should now look something like the following for each crawled property mapped to a refinable managed property. Note that ‘Refine’ appears in the column as shown; this is what makes the column filterable.
There is no requirement to do this for several system-generated columns such as ‘Created’ as these are automatically made refinable. However, see below in section on creating the filters to see whether some system columns may need to be mapped.
Once all the refinable managed properties have been created (and documented), the next step is to add these to a search vertical. Note that the above process is identical if you are using Search PnP web parts as they are required for the ‘Filters’.
The rest of this post relates to creating filters in Microsoft Search.
Create a filter in Microsoft Search
Return to the Site Settings for the SharePoint site where the columns have been added, or the hub site.
Under ‘Microsoft Search’, select ‘Search insights and configuration’.
In the page that opens, ‘Custom experience’, select the ‘Verticals’ tab as shown below.
Note: These are the same verticals that will appear in an OOTB search.
Click on ‘+Add’ to create a new vertical (rather than modifying an OOTB vertical). The name of the vertical is what will appear in the search results section in Microsoft Search.
In the ‘Content source’ section, select ‘SharePoint’.
In the ‘Query’ section, add a Keyword Query Language (KQL) query if required (unlikely).
In the ‘Filters’ section, click on ‘Add a filter’.
Scroll through the list of managed properties that appear. Consider adding the following OOTB options:
- Created. Enable the ‘User input box’ to allow the user to enter a range of dates (otherwise only actual dates will be shown).
- File Type. Select ‘Multiple’ to allow a selection between different file types (e.g., Word, PDF etc)
Now add each of the items created previously as refinable managed properties.
Scroll down to the find the refinable managed property that was mapped to a crawled property (e.g., ‘RefinableString102’). Enter the name that will appear in the vertical, select if the user will be able to select one or more values.
Once all the filters have been added, in the Review section, click on ‘Enable’ to enable the vertical, or ‘Update vertical’ if any changes have been made.
Note:
- The list of verticals may appear un-editable. Simply double click on any vertical to make the edit option appear.
- Once created, the new (or modified) vertical may take up to 24 hours to appear (or change).
When the user conducts a search, one or more filters will appear if any metadata in the search results matches the Crawled Property in the Refinable String.
Feature image: Pexels