Yes, you can tell in Typed Search using the Best Bet Repository class.
Check out the ApplyBoostedProperties method in the Foundation Search Service
Foundation/SearchService.cs at develop · episerver/Foundation (github.com)
/// <summary>
/// Sets Featured Product property and Best Bet Product property to ProductViewModels.
/// </summary>
/// <param name="productViewModels">The ProductViewModels is added two properties: Featured Product and Best Bet.</param>
/// <param name="searchResult">The search result (product list).</param>
/// <param name="currentContent">The product category.</param>
/// <param name="searchQuery">The search query string to filter Best Bet result.</param>
private void ApplyBoostedProperties(ref List<ProductTileViewModel> productViewModels, IContentResult<EntryContentBase> searchResult, IContent currentContent, string searchQuery)
{
var node = currentContent as GenericNode;
var products = new List<EntryContentBase>();
if (node != null)
{
UpdateListWithFeatured(ref productViewModels, node);
}
var bestBetList = _bestBetRepository.List().Where(i => i.PhraseCriterion.Phrase.CompareTo(searchQuery) == 0);
//Filter for product best bet only.
var productBestBet = bestBetList.Where(i => i.BestBetSelector is CommerceBestBetSelector);
var ownStyleBestBet = bestBetList.Where(i => i.BestBetSelector is CommerceBestBetSelector && i.HasOwnStyle);
productViewModels.ToList()
.ForEach(p =>
{
if (productBestBet.Any(i => ((CommerceBestBetSelector)i.BestBetSelector).ContentLink.ID == p.ProductId))
{
p.IsBestBetProduct = true;
}
if (ownStyleBestBet.Any(i => ((CommerceBestBetSelector)i.BestBetSelector).ContentLink.ID == p.ProductId))
{
p.HasBestBetStyle = true;
}
});
}
From https://world.optimizely.com/documentation/developer-guides/search-navigation/NET-Client-API/searching/Best-Bets/ i see that IsBestBet() (i states that the method is called IsBestBetStyle, but it seems to be a typo?) and HasBestBetStyle() only work for unified search. Is there now way of telling if a hit in types search is a result of best best settings?
Regards,
Bjørn Terje Svennes
Running .Net client version 13.4.4.0