The Ranking interface

You can override or update a widget's configuration at runtime. You do this in the search request itself. Various rules are driven by the attributes of the entity in the request.

This topic describes the interface of the object used at runtime to rank attributes during a search.

Ranking interface

Property

Type

Description

name

string

Required.

Name of the attribute to use for ranking. You must mark the attribute for search ranking in Sitecore Search by clicking Administration > Domain Settings > Attribute > Use For Features.

weight

number

Weight to apply to this ranking attribute. The default is 1.0. You can enter any value between 1 and 100, but we recommend that you pass a low value to minimize the impact of a single component on the overall scoring system.

If you rank by a timestamp attribute such as last_modified, for example, the weight for potential matches changes with time as follows:

  • Potential matches whose timestamp attribute exactly matches the request's timestamp get the full weight.

  • Potential matches whose timestamp attribute is more than one week behind the request's timestamp get a weight of zero.

For example, you send a request on Friday, May 26 at 1:30pm with a ranking weight of 3. A content item whose last_modified attribute has a value of May 23 will get a ranking weight of 1.5. However, a content item whose last_modified attribute has value of May 15 will get a ranking weight of 0.

Note

Unless indicated otherwise, all values are optional.

Do you have some feedback for us?

If you have suggestions for improving this article,