I am using the built-in search in EPiServer, and so far so good. However I need to display the part of the page that matches the query. For instance: A user searches for "water" and in one page the match is "it is water in the ocean" , I want to display:
1) title of the page
2) the text where the search matched.
Is this possible?
Figured out this is inside the IndexResponseItems property on SearchResults
A bit of a follow-up here: Through the IndexResponseItem I am able to extract DisplayText and Title, When I then try to fetch a link to the result through the Uri property I only get strings on this format:
Earlier I used :
var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>();
urlResolver.GetVirtualPath(someContentReference here); <-- giving me a nice url like :/production/myitem/
However, I dont have a contentreference for the result. Any suggestions ?
Solved it like this:
string myUrl = urlResolver.GetVirtualPath(contentSearchHandler.GetContent<PageData>(item).ContentLink)