I have built a custom search experience that leverages the SharePoint 2013 Search Service App. The search app is written in ASP.NET using the server-side object model. I am using the KeywordQuery class to facilitate the execution of a user's search query to pull back the search results and display the results in a grid view. Right now, the search summary for each result returned is based off of a custom managed property that is mapped to some specific metadata fields. I have a request to have the search summary show the exact places in the content where the keyword matched - similar to how SharePoint search shows the bolding of text in the search summary (in the OOTB search interface) as well as how Google shows the search summary. Is there an easy way to get access to the search summary from SharePoint programatically via the KeywordQuery class approach? I am using C#. I'm hoping there is a SelectedProperty that has this information. Any help is appreciated.
1 Answer
Try the HitHighlightedProperties and the HitHighlightedSummary properties. These should contain the summary information for each hit.
You will need to format these values and convert them to HTML (using XSLT, for example).