Variations and rules

In Sitecore Search, a widget's configuration is stored in variations. You can create as many variations as you need, but only one is set as Active at any time. Similarly each page also has an active variation.

At runtime, the headless response from Search includes the active page variation and active variations of all widgets in it.

Tip

With variations, you can:

  • Have page variations with different widgets.

  • Schedule switching pages or widget variations.

  • Split test variations to identify which one best meets your business needs.

Widget variation contain rules that modify behavior in predefined contexts. For example, Use Recipe A when visitor is from Canada otherwise use Recipe B. A variation can have multiple rules as long as no two rules are duplicates or contradict one other.

At runtime, when Sitecore Search receives a data request for a widget, it uses the active variations of both the global widget and the requested widget to create a consolidated configuration, which it then uses to generate results.

In the variation framework, all widgets inherit the configuration of the active global widget variation. If you add rules to a variation of a widget, they're assigned the highest order of precedence, meaning they take priority over any conflicting rules inherited from the global widget.

Anatomy of a rule

All rules have Context, Strategies, and Settings sections that contain all the configuration required to optimize results. Rules for recommendation widgets also include a section named Recipe, which is used to set the recipe or AI algorithm in the search process.

In Search, variations and the rules they contain play an important role in optimizing results. A rule only alters the behavior of a widget variation when the conditions described in the Context are met.

The following image shows the three sections as available for preview search and search results widgets.

Placeholder items in the Strategies section of a new rule.

Context

In the Context section of a rule, you define the criteria for when a rule applies. There are two types of context:

  • Site context defines where in the site a visitor must be for the rule to take effect.

  • Visitor context defines what aspects about a visitor affect whether the rule applies to them, such as if they are new or returning visitors.

The immediate advantage of setting context values is control over who can see certain results and when they are displayed. If you do not set a context, the rule applies to all site areas and to all visitors.

Tip

When you set a context for a rule, the rule editor displays a sample set of items that a visitor will see if they fit that context.

 

Important

To set a rule context that always applies to all widgets, you can add it to a global widget variation and then set the variation's status to Default.

Recipes

In the Recipes section of a rule, you can assign the recipe or AI algorithm used to generate results for the recommendation widget.

Strategies

In the Strategies section of a rule, you can configure how results are prioritized, excluded, or included, such as:

  • Pinning an item to a specific slot in the widget's display.

  • Boosting and including specific items.

  • Burying and blocking items.

Settings

In the Settings section of a rule, you can modify the priority and availability of feature options created for domain-wide use, which include:

The following lists some typical examples:

  • Overriding default user interactivity, facets, and sorting options in search results widgets.

  • Displaying trending items and search ranking options in preview search widgets.

Important

You cannot create new options within a rule or the global widget.

To create new options or edit existing ones, go to the Feature configuration tab on the Administration > Domain settings page.

Use cases

You can create as many rules as you need to cover various context scenarios and your business needs.

The following are some typical use cases for rules:

A typical use case for variations is to schedule a variation with rules that reflect a campaign .

Do you have some feedback for us?

If you have suggestions for improving this article,