Optimizing search experiences with rules

When defining the experience a widget provides, you configure how it creates or updates requests and how it displays the results. Widget variation rules are an essential part of the widget variation framework. A rule in a widget variation defines how the variation appears and behaves.

Anatomy of a rule

The three sections in a typical widget variation rule are Context, Strategies, and Settings.

Screenshot showing 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 to which visitors the rule applies.

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.

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

Note

You can set rule context that applies to all widgets in a global widget variation.

Strategies

In the Strategies section of a rule, you can customize search results and their display in a widget to:

  • Filter for an attribute and its value.

  • Filter for keywords.

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

  • Boost, bury, and block items.

Settings

In the Settings section of a rule, you can customize or configure the display of a widget. The following lists some typical examples:

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

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

Rules in the variation framework

You can use rules to alter behavior according to widget variation. The Site context and Visitor context of a rule define the conditions that have to be met when the Strategy and Settings are applied.

You can configure rules in variations of all widgets including the global widget. A widget variation can have multiple rules as long as no two rules are duplicates and contradict each other.

In the variation framework, all widgets begin with the configuration of the Active global widget variation. When you add rules to a widget variation, your rule is building on top of or overriding rules or settings of the widget and the global widget.

Therefore, when a widget variation rule duplicates or contradicts a rule of the Active global widget variation, the widget variation rule always trumps.

The following are some typical use cases:

Rule rankings in multirule widget variations

In the variation framework, a widget variation can have multiple rules, each with its own context. The widget variation also inherits all rules defined in the Active global widget variation.

At runtime, you can allow the system to rank the rules or use a previously configured ranking. The rank defines which rule takes priority.

Note

At runtime, our ranking system ranks rules every time a widget variation or a global widget variation changes.

In most cases, you can skip ranking rules as a static list.

In the CEC, on the Widget Variation page, on the Rules tab, the list of rules ranked in order of priority, includes:

  • All rules added to the widget variation.

  • All rules from the active global widget variation.

Each row or rule has a column dedicated to a rule section: Context, Strategy, and Settings.

The Rank column displays the priority the rule gets during application. If there is conflict between two rules, appears in the rule. When you hover over the icon, you get a warning message.

Scheduling widget variations

Before you schedule a widget variation, consider the following:

  • If a widget variation has been set to be the default variation, you cannot schedule it.

  • The default variation is active when another variation is not scheduled.

  • Discover prioritizes the scheduled variation over the default variation for the time specified in the schedule.

  • At the end of a widget variation's schedule, the widget reverts to its default variation if there isn't another widget variation scheduled.

  • You can schedule widget variations to run for days, weeks, and even months.

  • You can schedule widget variations, days, weeks, and even months in advance.

Note

Two variations of a widget cannot have overlapping schedules.

Example: Consolidation of widget variation rules

Let's assume that both widget variation A2 and B1 have rules. The default variation of the global widget also has a rule. The following diagram shows the widget variations and their rules:

Diagram showing how variation rules are consolidated at runtime.

When widget variations are Active and the Context 1 conditions, as shown in diagram,apply, only the following rules come into play:

  • 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)

Example: Ranking of rules

Consider a widget variation with four rules as shown in the following screenshot:

Screenshot of ranked rules in a widget variation.

Rank

Description

4

Global widget variation rule.

When the browsing locale is en_us or en_ca, always boost results whose topic attribute is set as Constitution.

3

Widget variation rule.

When visitor is browsing from Canada, block or exclude results whose topic attribute is set as US Constitution.

2

Widget variation rule.

When visitor is browsing from US, blacklist or exclude results whose topic attribute is set as Canadian Constitution.

1

Widget variation rule.

When the browsing locale is not en_us or en_ca, always 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 the 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.

They will not be shown results with the following topics: Constitution and Canadian Constitution.

They will see all content types.

Rule 3 overrides Rule 4 or the global widget variation rule and excludes Constitution topics.

For all others browsing in the US and not using the English US locale site.

They will not be shown results with the following topics: Constitution and Canadian Constitution.

They will not see any content type video.movie.

The global widget variation rule is not applied.

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

Context

Rule and behavior

For those browsing in Europe using the English US locale site.

Results with Constitution as topic are moved to the top.

They will see all content types.

For those browsing in Europe and not using the English US locale site.

Results with Constitution as topic are moved to the top.

They will not see any content of type video.movie.

Do you have some feedback for us?

If you have suggestions for improving this article,