Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

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

Recommended reading 

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 find this information helpful? Please log in to provide feedback.

Last updated: Jun 10, 2014

Recommended reading