Lucene scoring for the Sitecore.ContentSearch indexes


Description

When searching, Lucene.Net assigns some score value to each of its documents based on the relevance of the particular document and returns results ordered by these scores.
The document score itself is calculated by multiplying the boost value of a document on some other factors, such as how many query terms are found in the particular document, the frequency of the found query terms in this document, etc.
But the boost value of the document is taken from the Boost Value field of a corresponding item which is empty by default and is resolved as 0 when indexing.
Thus, when searching in Sitecore indexes, all found documents have their score value equal to 0, so they are not sorted by relevance.

Solution

To enable sorting by relevance in the search results, perform the following steps:

  1. Navigate to the /sitecore/templates/System/Templates/Sections/Indexing section.
  2. Create a Standard Values item for this section.
  3. Enter the value 1 in the Boost Value field of the above-mentioned Standard Values item.