Search result boosting

Current version: 9.3

In Sitecore XP, there are two ways to boost search results - query-time boosting and index-time boosting.

Query-time boosting

Query-time boosting lets you control the contents and ranking of the search results of individual queries at runtime. The context of the user when they invoke the search query provides information that is not available when the index is compiled, and this provides greater opportunities for dynamic interaction. For example, you can amplify or reduce the boosting value of a field when you invoke a search query based on location, visit number, persona, purchase history, and so on. Query-Time boosting is currently only available in the LINQ layer must therefore be implemented by developers.

Here is an example:

SOLR syntax

LINQ to Sitecore

_name:Sitecore^4 CMS

.Where(c => c.Name.Equals("Sitecore").Boost(4) || c.Name.Equals("CMS"))

This example returns results that have the word Sitecore or CMS, or both in the item name and the items that have Sitecore in the item name are listed higher in the search results than the items that have CMS in the name.

Note

Search engines take the length of a field into consideration. an item named CMS could still appear higher in the search results than an item named, for example, Sitecore is also a marketing automation tool.

Query-time boosting:

  • Is more precise than index-time boosting.

  • Can be applied per query.

  • Can be changed without having to rebuild the entire index.

Index-time boosting

Important

Search result boosting works in Solr version 6.6 or earlier. However, Solr removed support for index-time boosting in Solr 7. As a result, field-level boosting is no longer supported and any boosts that are provided are ignored by Solr.

In Sitecore XP 10.0.0 or later, item-level boosting relies on index-time scoring factors that are indexed in the __boost field and combined with the query score using the query _val_:__boost function.

You can boost specific items when they are indexed. These items will get a higher score than other items. You can use boosting, for example, to promote the most popular or the most sold books in a bookshop in a search result.

Field-level boosting

Any boost values that are provided in the configuration are ignored.

Item-level boosting

The indexing.resolveItemBoost pipeline resolves item-level boosting. The following processors are enabled in this pipeline:

RequestResponse
<processor type="Sitecore.ContentSearch.Pipelines.ResolveBoost.
      ResolveItemBoost.ItemLocationFilter, Sitecore.ContentSearch">
    <includedLocations hint="list">
      <content>/sitecore/content</content>
      <media>/sitecore/media library</media>
    </includedLocations>
</processor>
<processor type="Sitecore.ContentSearch.Pipelines.ResolveBoost.
      ResolveItemBoost.StaticItemBoostResolver, Sitecore.ContentSearch"/>
<processor type="Sitecore.ContentSearch.Pipelines.ResolveBoost.
      ResolveItemBoost.LocalRuleBasedItemBoostResolver, Sitecore.ContentSearch"/>
<processor type="Sitecore.ContentSearch.Pipelines.ResolveBoost.
      ResolveItemBoost.GlobalRuleBasedItemBoostResolver, Sitecore.ContentSearch"/>

The ItemLocationFilter processor ensures that only items in the specified locations are processed by the pipeline. You can extend this list in this way:

RequestResponse
<includedLocations hint="list">
   <content>/sitecore/content</content>
   <media>/sitecore/media library</media>
   <custom>/sitecore/custom</custom>
</includedLocations>

The StaticItemBoostResolver processor reads the boost value of the indexed item.

This value can also be set for all items based on a template using __Standard Values fields. To see the Indexing section of items, you must select the Standard Fields check box on the View tab in the Content Editor. The Boost Value field is in this section.

Rule-based boosting

The LocalRuleBasedItemBoostResolver and the GlobalRuleBasedItemBoostResolver processors provide rule-based boosting for indexed items. These two processors are both executed using the rules engine. They look up boosting rules in different locations:

  • The LocalRuleBasedItemBoostResolver processor reads rules from the Boosting rules field in the Indexing section.

    The source of the Boosting rules field is restricted to the following location where all boosting rules are managed:

    /sitecore/system/Settings/Rules/Indexing and Search/Item Rules

    This set of boosting rules can also be set on the __Standard Values level, just as other field values.

  • The GlobalRuleBasedItemBoostResolver processor processes all boosting rules created under /sitecore/system/Settings/Indexing and Search/Rules/Global Rules.

For performance reasons, use the local boosting rules as much as possible.

Create a boosting rule

You can create a boosting rule that is used locally per item, or a global rule. You create global boosting rules as children of the Global Rules item; you create local boosting rules as children of the Item Rules item.

To create a boosting rule:

  1. Navigate to this item in the content tree:

    /sitecore/system/Settings/Rules/Indexing and Search/

  2. To create a new local item rule, right-click on the Item Rules item and then click Insert,Boosting Rule:

  3. In the Message dialog, enter a name for the new rule. For example, you can create a boosting rule that boosts all items in English:

  4. Select the new rule and in the Data section, click Edit rule. The Rule Set Editor opens:

  5. Select the conditions for your rule. For example, to create a rule that boosts all items in English, in the Item Version section, select the where the item language compares to value condition from the list and then edit the condition as follows:

  6. In the Indexing & Search section, select the adjust boost by select action:

  7. In the Rule description section, click select and adjust the boost value. The boost value can be either a positive or a negative number.

Do you have some feedback for us?

If you have suggestions for improving this article,