Try our conversational search powered by Generative AI!

How to return assigned Category to a page with Epi Find results

Vote:
 

Hi Epi Devs,

Wondering how you set up the search so that it returns the category of the page that's been index and return in search? 

I can see in the indexed JSON that the category is there.

#182461
Sep 20, 2017 4:26
Vote:
 

One way I have found is to create a method to convert a hit, returned by Find, into a PageData object and calling this when processing the results.  This gives access to the page properties and can then be cast as a page of specific type to get page type specific properties.

public static PageData ConvertFindResultToPageData(UnifiedSearchHit hit)
{
    var url = new UrlBuilder(hit.Url.ToString());
    var hitReference = UrlResolver.Current.Route(new UrlBuilder(url));
    PageData hitPage = DataFactory.Instance.GetPage(new PageReference(hitReference.ContentLink.ID));

    return hitPage;
}
#182554
Sep 22, 2017 15:22
Vote:
 

Thanks, Darren.

I will try this out.

#182569
Sep 24, 2017 13:31
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.