We have an implementation of Episerver Find (version 126.96.36.19974) and our client wants to add Best bets for their sub domain links, which in turn I believe we have to use the External Link on Best bets.
With Episerver Find we can successfully add the best bets for local and external link, when serching for Local from front end it returns the results, however when we tried to search those ones defined in external best bets, it does not return any values. All the time we have 0 Record count from the episerver find.
Tried with after Indexing.
Analysing the index, we can see the ExternalBestBets in overview section of episerver find. Following is what it looks like in Index, there are no titles, search string, etc.,
"$type": "EPiServer.Find.Framework.BestBets.ExternalUrlBestBet, EPiServer.Find.Framework",
However, the local link search works fine.
Is this something an issue with episerver.find and if any one managed to make it to work.
Can you post your query?
Here is my code
Below is my code to build findFilter
var findFilter = _client
.And(x => x.MatchTypeHierarchy(typeof(ISearchableContent)) & !(x as ISearchableContent).HideFromSearch.Match(true))
.Or(x => x.MatchTypeHierarchy(typeof(ExternalUrlBestBet)));
var search = _client.UnifiedSearchFor(query)
.Skip((page - 1) * itemsPerPage)
And the code to return results from search is
var searchResult = search
I checked one of our sites and a ExternalBestBet looks like that in our index as well. Do you get the hit to show if you remove the .Filter() call?
Thanks Johan, I get hits with filters on as shown on my code above, however the point it fails is when I am trying to convert the search Results into PageData, to get meaning information to display it on search page.
var searchResult = search
The above code returns hit, the point it fails is on below code
var results = searchResult
.Select(result => result.GetOriginalObject<TResult>())
Following is the implementation for GetOriginalObject which is an searchextension. For externalBestBet the OriginalObjectGetter is null, and hence it cannot find the Original Object.
public static T GetOriginalObject<T>(this UnifiedSearchHit hit)
if (hit.OriginalObjectGetter == null)
var original = hit.OriginalObjectGetter.Invoke();
if (original is T)
return (T) original;
There is a bug raised for Original Object Getter being null , https://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=150369 on 2016, with no solution to it.
Any other thoughts would be greatly appreciated.
I think an external best bet won't have an original object like that. At least it won't be convertible to PageData but probably just a minimal ISearchContent/UnifiedSearchHit.
Thanks for that Johan, finally implemented with the minimal info from unifiedsearchhit resultset.