Epinova / Epinova.Elasticsearch

A search-plugin for Episerver CMS and Commerce
MIT License
29 stars 20 forks source link

When .UseBestBets() - and search for a BestBet term - only the BestBet item is returned #30

Open tsolbjor opened 5 years ago

tsolbjor commented 5 years ago

When a BestBet term is added to the query for boosting at https://github.com/Epinova/Epinova.Elasticsearch/blob/4cc47efe9399aa505bff0c762027c3431dd36e39/src/Epinova.ElasticSearch.Core/Engine/QueryBuilder.cs#L292

a constraint is added to require the bestbet to be a hit: https://github.com/Epinova/Epinova.Elasticsearch/blob/4cc47efe9399aa505bff0c762027c3431dd36e39/src/Epinova.ElasticSearch.Core/Engine/QueryBuilder.cs#L429

All other hits to the main query is then filtered and only the BestBet is returned.

When setting request.Query.Bool.MinimumNumberShouldMatch = null; I get the expected result.