I'm currently working on an autocomplete function within Episerver Find. I've seen some solutions already, but none of them seem to work for the case I want it to.
I have a working autocomplete, but this autocomplete does not take into account the best bets, which I would like on top of the autocomplete return. The best bets are external urls and don't seem to work with PageData.
The current solution:
public static SearchResults AutoComplete(string q)
var result = SearchClient.Instance.Search()
.Filter(x => x.Name.PrefixCaseInsensitive(q))
.Select(x => x.Name)
The solution I'm working on aswell (Where instead of the best bet, I'm struggling on the filters for autocomplete):
public static IEnumerable AutoComplete2(string q)
var result = SearchClient.Instance.UnifiedSearchFor(q)
// Can't seem to get working filters here.
.Select(x => new SearchItem(x))
Any feedback is appreciated!
You can try ApplyBestBets() after the filters and before GetResults() (or caching). The filters may be fitlering out the best bets?
Hey David, thank you for your response and sorry for the late reaction.
I've tried your solution, however it doesn't seem to change the outcome of the function. I'm still searching for a solution for an autocomplete with bestbest included.