---
title: "Rule ranking and consolidation"
slug: "rule-ranking-and-consolidation"
abstract: "How rules are ranked and consolidated by Sitecore Search at runtime."
---
# Rule ranking and consolidation

In Sitecore Search, a page contains widgets and each widget can have multiple variations with rules. The rules in a variation become available only when the variation has an *Active* status.

At runtime, rules are selected, ranked and consolidated as follows:

1. Only widgets on the *Active* page variation are available.
2. Each widget on the *Active* page variation inherits the rules of the *Active* global widget variation and the rules of the *Active* variation of every widget on the page.
3. Based on the site and visitor context, for each widget, the system ranks the rules applicable in both the *Active* widget variation and the *Active* global variation.

> [!note]
> The system ranks rules every time the *Active* variation or context conditions change. In most cases, the system skips ranking when you provide a static ranked list.

## Example: Widget with multiple rules

On the **Widget Variation** page, the **Rules** tab lists rules in order of priority, including:

- All rules added to the widget variation.
- All rules from the active global widget variation.

The following image shows a widget variation with four rules. Each row, or rule, has a column dedicated to each rule section: **Context**, **Strategy**, and **Settings**. The **Rank** column displays the priority the rule[^UUID-48c6b92f-d97a-3d5b-9006-85685f9183f0_N6762849012bd2] will have during application. If there is conflict between two rules, ![Conflict](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/rules-conflict-icon.png) appears in the rule card. If you hover your cursor over this icon, you'll receive a warning message.

![Ranked rules in a widget variation.](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/rules-ranking.png)

The following table describes the ranked rules in the screenshot. The results can include the videos and books on *Constitution*, *Canadian Constitution*, and *US Constitution*.

| Rank | Widget | Description |
| --- | --- | --- |
| 4   | Global widget. | When the browsing `locale` is *en_us* or *en_ca*, always boost results whose `topic` attribute is set as *Constitution*. |
| 3   | Widget. | When visitor is browsing from *Canada*, block or exclude results whose `topic` attribute is set as *US Constitution*. |
| 2   | Widget. | When visitor is browsing from *US*, block or exclude results whose `topic` attribute is set as *Canadian Constitution*. |
| 1   | Widget. | When the browsing `locale` is not *en_us* or *en_ca*, exclude results whose `content_type` attribute is set as *video.movie*. |

> [!note]
> Rules are applied bottom-up. A rule with a lower rank number overrides the previously applied rules. To override the assigned ranking, drag a rule up or down.

The following table describes how these rules and behaviors are consolidated by **Context** for visitors browsing in the US:

| Context | Rule and behavior |
| --- | --- |
| For those browsing in the US and using the English US locale site.Locale: en_usLocation: Within the US | Rule ranked 1: They will see all content types.Rule ranked 2: Excludes all content with Canadian Constitution as topic.Rule ranked 3: Does not apply.Rule ranked 4: Books with Constitution as topic are moved to the top. |
| For all others browsing in the US and not using the English US locale site.Locale: es_esLocation: Within the US | Rule ranked 1: They will not see any content of type video.Rule ranked 2: Excludes all content with Canadian Constitution as topic.Rule ranked 3: Does not apply.Rule ranked 4: Does not apply. |

The following table describes how the rules and behaviors for visitors browsing in Europe:

| Context | Rule and behavior |
| --- | --- |
| For those browsing from Madrid, Spain using the English US locale site.Locale: en_usLocation: Madrid, Spain | Rule ranked 1: They will see all content types.Rule ranked 2: Does not apply. Can see all content with Canadian Constitution as topic.Rule ranked 3: Does not apply. Can see all content with US Constitution as topic.Rule ranked 4: All content with Constitution as topic are moved to the top. |
| For those browsing from Madrid, Spain and not using the English US locale site.Locale: es_esLocation: Madrid, Spain | Rule ranked 1: They will not see any content of type video.Rule ranked 2: Does not apply. Can see books with Canadian Constitution as topic.Rule ranked 3: Does not apply. Can see books with US Constitution as topic.Rule ranked 4: Books with Constitution as topic are moved to the top. |

## Example: Multiple page and widget variations

In the following example, there is a page with two variations called *PAGE_X* and *PAGE_Y* each with widgets. Widgets A, B, and C have at least 2 variations each.

![Diagram of how page and widget variations are consolidated at runtime.](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/variations.png)

Based on the status of every variation, the visitor sees the following:

- Page variation PAGE_X showing widget variations A2 and B1.
- Widget variation A2 because its status is *Active*.
- Widget variation B1 because its status is *Default* and widget B does not have an active variation. B1 is *Active* by default.

> [!note]
> The visibility of a variation depends on its variation status.

## Example: Widget variations with multiple rules

In the following example, there is a page with one widget. The widget has only one variation with two rules. The default variation of the global widget has one rule.

![Diagram showing how variation rules are consolidated at runtime.](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/rules-variations.png)

When widget variations are *Active* and the Context 1 conditions are met, the following rules are applied:

- For widget variation A2 Rule A2-R1 (Block), Rule A2-R2 (Sorting), and Rule A2-R3 (Boosting).
- For widget variation B1 Rule B1-R1 (Bury) and Rule G1-R1 (Block)

[^UUID-48c6b92f-d97a-3d5b-9006-85685f9183f0_N6762849012bd2]: A modification to widget behavior that can be used to overwrite the natural set of results, for example, to boost, bury, pin, and blacklist items. A rule can have its own variations as well as its own rules, and is evaluated when called from the customer website.
