Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

Get Title and Excerpt when applied Best Bets to a Typed Search?

$
0
0

I have applied best bets to the Typed search as the Episerver developer documentation stated it. Is there a way to get the Best bet Title and the Excerpt (which are defined in the best bet edit mode in Epi Admin).

My implementation as of now,

// Sample Pages are stored in the Find Index
public class SamplePage : EPiServer.Core.PageData
    {
        public string SamplePageTitle { get; set; }
        public string SamplePageDescription { get; set; }
    }
public class SearchResult
    {
        public string Title { get; set; }
        public string Description { get; set; }
    }
// Getting the results
var result = client.Search<SamplePage>(GetLanguage(LanguageID))
                .For(Query, SearchHelper.QueryStringQueryAction)
                .Select(x => new SearchResult
                {
                    Title = x.SamplePageTitle, // Any way to have the Best Bet title ?
                    Description = x.SamplePageDescription // Any way to have the Best Bet Excerpt?
                })
                .ApplyBestBets()
                .Take(PageSize).GetResult();

As I have mentioned above, is there a way to get the Title and Excerpt?

Thanks.


Viewing all articles
Browse latest Browse all 6894

Trending Articles