A Content Enrichment Example: Search Refiner by WebApplication Display Name
On SharePoint
In this post I will describe in details how to refine SharePoint search results by Web application Display name. In SharePoint as OOTB there is no managed property stores
the web application name in SharePoint 2013.
Firstly, in order to filter the search results using web application display name we need to create new managed property of type
text and make it refinable and active.
Secondly, to get the web application name and store
it in the new refinable managed property we just created. We need to utilize the
Content Enrichment callout architecture and create new WCF service to process the
search items and write the appropriate value to managed property “WebApplicationDisplayName”
I followed this MSDN article with little
changes, the input property in my example will be the siteID which represents
the site collection Guid. In the ProcessItem method I create new instance of
SPSite object using this unique Guid and then get the web application display
name and dispose of the SPSite object.
After wards, I created a new IIS application and deployed
the WCF service to it and run the below shell script to configure the search
content enrichment service.
To run this script you need to stop all crawling if you have
continuous crawling enabled you need to disable it
I notice that the service causes FileNotFound exception in the line responsible of the creation of the new SPSite instance. The reason was the default application pool identity need to be configured as the SharePoint application pool identity so it will be granted access to Content Database.
After a successful run I opened my search center, edit the
refiner Webpart in the search result page and added the WebapplicaitonDisplayName
to the top of my refiners.
and at the end the new search refiner will appear as below in the search page:
Full code is available in MSDN Code gallery here
No Comment to " A Content Enrichment Example: Search Refiner by WebApplication Display Name "