You cannot underestimate the importance of boosting your relevancy searches. As you can see below in the code snippet, applying a boost to your query is relatively easy. The boost method itself takes a double, which indicates how much boost you wish to apply to that condition. This ultimately affects the the sort order when the query is returned from the search provider layer. One thing to keep in mind when doing a relevancy search is that you do not want to apply sorting to the search query.
The code below is searching on tours. It is saying that if you pass a NeoId, apply a boost of a factor of 5. If what you searched is contained in the tour’s title, apply a boost of a factor of 4. It goes through these different conditions until it searches without a boost on the basic tour content (summary, description among a few other things).
string keyword = contentParameter.Values.ToLower(); Expression<Func<TourResultItem, bool>> innerPredicate = PredicateBuilder.True<TourResultItem>(); innerPredicate = innerPredicate.And(i => i.NeoId.Equals(keyword).Boost(4f) || i.TitleWords.Contains(keyword).Boost(3f) || i.CountryNamesLowercase.Contains(keyword).Boost(2f) || i.ContinentNamesLowercase.Contains(keyword).Boost(2f) || i.ColletteContent.Contains(keyword));