In this article I will be covering the process of adding Sites’ Title in the Search Filter of a SharePoint 2013/2016 site. A client I am currently working with has a dozen of what they call “legacy” sites. They went ahead and created a dedicated Result Source to allow people in their organization to search only for content stored in these sites. What they want, is for a new “Site Title” section to show up under this ResultSource to allow people to filter their search result based on a specific site.
The SharePoint site has a wildcard managed path named “Legacy” and has 3 site collections created:
I have a Search Center created at /sites/Search, and a Result Source defined within it that only search content of sites located under the Legacy managed path
Create a New Managed Property
By default, searching for documents inside the Legacy Result Source will only provide me with the Time Range slider and Author list as Filters (see Figure below).
In order for us to add sites’ title as a filter, we first need to ensure it has an associated Search Managed Property. To do so, navigate to your Search Service Application in Central Administration and select Search Sources from the left navigation.
Once in there, search for a RefinableString property that is not yet mapped to any crawled properties. In my case, I will select RefinableString00.
On the managed property edit page, scroll to the bottom of the page, to the Mappings to crawled properties section. Click on Add a mapping.
On the Crawled property selection, search for and select the ows_SiteName property.
Back on the managed property screen, click OK to save the mapping. go back to the Search Administration page and initiate a Full Crawl of you content.
Configure the Filter Panel
Now that the information about our sites’ titles is available as a managed property within Search, we can go ahead and update the refinement (filter) webpart on our Legacy search page to include it as a refiner. To do so, navigate to your search page and edit the page. Click on the Refinement web part and select Edit Web Part.
In the Refinement properties panel on the right hand side, click on Choose Refiners….
In the Available refiners section, find the Refinablestring00 property we just modified, and click on Add > to add it to the Selected refiners section on the right. Once that is done, Change its Display name to Site Title and click OK.
Click OK in the web part properties panel on the right, and save (or check-in) your page. You should now be able to use your new refiner as shown in the Figure below.