This content is archived. See latest version here

Last updated: Jun 10 2014

Introduction

Best Bets can be used to promote certain content when search query matches specific phrase. Content included in the Best Bet will appear on top of the search results, as those hits will have a higher boosting applied to them.

Applying Best Bets

In order to apply Bets Bets to the search results ApplyBestBets extension method should be used for ISearch or ITypeSearch in EPiServer.Find namespace:

Unified Search

C#
var results = client.UnifiedSearchFor("Beethoven").ApplyBestBets().GetResult();

There is an overload that accepts boost index ApplyBestBets(double? boost). This boost index affects how much influence a matching Bets Bet will have on the search results score. By default boost index is 1000.

C#
var results = client.UnifiedSearchFor("Beethoven").ApplyBestBets(200).GetResult();

Typed Search

Its possible to apply best bets to arbitrary types which you have indexed. Below is an example of how this can be solved.

C#
var results = client.Search<Contact>For("Beethoven").ApplyBestBets().GetResult();

Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/