The Solr search provider in Sitecore 7 allows users to rank the search results using different types of boosting methods. This article shows how to use the Query-Time Boosting to sort the search results and highlights the common mistakes that developers should avoid.
Assume that you want to run a search query over a set of Sitecore items, each of which has a title and description fields, and you would like the score of the results that contain the search keyword in the title to be higher than the ones contain the search keyword in the description.
The search query that uses Query-Time Boosting should look like:
var query = "guitar"; var dataQuery = context.GetQueryable<SearchResultItem>() .Where(i => i.Title == query.Boost(3.0f) || i.Description == query.Boost(1.0f))
Read More Sitecore 7 & Solr – Sorting Search Results by Score