Try our conversational search powered by Generative AI!

Episerver Find: Get PageData from UnifiedSearchResult

Vote:
 

Hi there,

Not sure if I'm missing something simple here, does anyone know an efficient way of getting the PageData or IContent reference from a Unified Search result in Episerver Find?

I know one way it could be done is doing a content repository lookup from the URL, but I would've thought the UnifiedSearchResult object would include a content reference buried  somewhere in the results?

Cheers

#191700
Edited, Apr 26, 2018 17:30
Vote:
 

Moved post to Episerver Find forum.

#191703
Apr 26, 2018 17:52
Vote:
 
public static T GetOriginalObject<T>(this UnifiedSearchHit hit)
{
    if (hit.OriginalObjectGetter != null)
    {
        var original = hit.OriginalObjectGetter.Invoke();

        if (original is T)
        {
            return (T)original;
        }
    }

    return default(T);
}
#191711
Apr 26, 2018 20:30
Vote:
 

How would I impliment this in the Alloy FindSearchPage?

I'd love to have more complete sample code for Find.

#194513
Jun 22, 2018 17:11
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.