London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Loading...
Area: Optimizely Search & Navigation
ARCHIVED This content is retired and no longer maintained. See the latest version here.

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();

Last updated: Jun 10, 2014