November Happy Hour will be moved to Thursday December 5th.

Implementing ApplyBestBets

Vote:
 

I'm trying to implement the ApplyBestBets function in my query without any success. I can add the phrase and point it to a page in edit mode but the hits does't show up when i do a search. I'm using EPiServer 6 R2. Do you have to use unified search for this to work?

My code:

Results = SearchClient.Instance.Search<PageData>()
.Filter(x => x.SearchText().AnyWordBeginsWith(SearchQuery))
.Select(x => new SearchHit
{
Title = x.PageName,
Url = PageUtility.GetFriendlyUrl(x.PageLink),
File = false,
Description = x.SearchText().Shorten(200),
Category = x.SearchSection()

})
.IncludeType<SearchHit, UnifiedFile>(x => new SearchHit
{
Title = x.Name,
Url = x.VirtualPath,
File = true,
Description = x.SearchSummary().Shorten(200),
Category = x.SearchFileExtension()

})
.Skip((PagingPage - 1) * PageSize)
.Take(PageSize).ApplyBestBets().GetResult();

 

Any ideas?

#72428
Jun 17, 2013 13:36
Vote:
 

I solved this issue by replacing my filter with this:

 .For(SearchQuery).Include(x=>x.SearchText().AnyWordBeginsWith(SearchQuery))

#72436
Jun 17, 2013 14:46
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.