We have upgraded to 13.2.2 and some code based on episerver posts that was working fine has broken.
This below was getting back the underlying type from UnifiedSearch, anyone have any idea how to fix without reloading the content.
/// Gets the original object.
/// <typeparam name="T"></typeparam>
/// <param name="hit">The hit.</param>
public static T GetOriginalObject<T>(this UnifiedSearchHit hit)
if (hit.OriginalObjectGetter != null)
var original = hit.OriginalObjectGetter.Invoke();
if (original is T)
Which version did you upgrade from? It might be not different, but you probably want to call it as hit.OriginalObjectGetter()
I also use this approach a lot:
var originalType = searchHit.OriginalObjectGetter.Invoke() as MyPreciousType;
It is working as expected in version 13.0.5.
Thanks guys, at the time of writing this the code was erroring out due to a null coming back. I had a thought that it might be something dodgy with a single record in Find from the upgrade possibly so I've added some proper null handling (which should of been there from the start) and there's a lot of results coming back now. At least this means this method is working.