1

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

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).

http://blogs.technet.com/b/tothesharepoint/archive/2013/09/05/understand-how-item-display-templates-and-hit-highlighting-work-in-sharepoint-server-2013.aspx#AboutHitHighlighting

http://sharepointcommunity.de/blogs/owirkus/archive/2014/04/08/sharepoint-using-the-keywordquery-for-search-driven-applications.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.