Business rules
A business rule is a setting that can be resolved from a search request. It is recommended that the business rules are managed via the Admin UI, but they can be set up via the Admin API. See the full API reference here.
Info
Please note that business rules is a new feature designed to simplify the management of commercial parameters, facets, affinities, pinning and relevance boosts. This feature is currently under development and is expected to be available in Q4 2024.
There are 5 different types of business rule actions. These actions configure the behavior of the search. For each business rule, the one with the best matching conditions is used.
A business rule consists of:
- Business rule id is used to uniquely identify the business rule.
- Name assigns an easy-to-read name to the business rule.
- Conditions are used to resolve the correct business rule when searching.
- Business rule action define the intended search behavior for the business rule.
Business rule conditions
Business rule conditions are used to specify which business rules are used. The more conditions that match data in the search request, the more relevant the business rule is. For each business rule action, the most relevant business rule with all conditions met is used.
Example
Business rule conditions form a hierarchy of conditions to match. Given the following business rule condition hierarchy for a business rule action:
graph TD;
_f[fallback
Fallback]
_f --> _browse[business_rule_browse
Scope = Browse]
_f --> _search[business_rule_search
Scope = FullSearch]
_browse --> _cat[business_rule_clothing
Category = Clothing]
_cat --> _red[Color = Red] --> _size[business_rule_red_xl
Size = xl]
_cat --> _yel[business_rule_yellow
Color = Yellow]
In order to get a graph like this, the business rules must be set up with the specific conditions.
Business rule | Conditions |
---|---|
Fallback | No conditions |
business_rule_browse | Scope = Browse |
business_rule_search | Scope = Fullsearch |
business_rule_clothing | Scope = Browse Category = Clothing |
business_rule_red_xl | Scope = Browse Category = Clothing Color = Red Size = xl |
business_rule_yellow | Scope = Browse Category = Clothing Color = Yellow |
In order to resolve the business rule business_rule_red_xl
, a request like below must be issued.
- If the
size
filter is changed, then thebusiness_rule_clothing
will be matched instead. - If the
color
filter is changed toyellow
, then thebusiness_rule_yellow
will be matched instead. - If the
category
filter is changed, then thebusiness_rule_browse
will be matched instead. - If the
scopeId
is changed tofullsearch
, then thebusiness_rule_search
will be matched instead. - If the
scopeId
is neitherbrowse
norfullsearch
, then the fallback business_rule will be used instead.
The business rule conditions that can be used are:
- Attributes
- Targets
- Scopes
- Categories
- If the search request contains a phrase
- If the search request contains a specific phrase
Business rule condition priority
Business rule conditions are prioritized in this order:
- Targets
- Scope
- Is Phrase search
- Is Phrase search with specific phrase
- Categories
- Other filters
If there are two business rules, one with a scope condition and one with a category condition, and a search request matches both, the business with the scope condition is used because it has the higher priority.
Fallback business rule
Each segment must have a fallback relevance boost business rule which is used if no other matching relevance boost business rule can be found. The fallback relevance boost business rule cannot have any conditions or be inactive, but otherwise behaves as other relevance boost business rule. Each segment must have exactly one fallback relevance boost business, if not, a conflict occurs in the publication.
Business rule actions
These are the following actions. they are described in detail below:
- Affinities
- Facets
- Parameters
- Pinned products
- Relevance boost
Affinities
Affinity business specify how much a person's affinity for the product should count in the score.
The sort order of the products is updated live as the weights are changed, allowing for an experimental approach.
Facets
Facet business rules set up which facets should be returned in a search response.
Each facet business rule can have one facet for each allowed filter. The match type is specified when a facet business rule facet is selected. The order of the facets when editing a facet business rule reflects the order of facets in search responses.
Example
For the product category clothes
, facets on size
and material
are needed for the customer to be able to select these properties by themselves.
A facet business rule for the category clothes
is created, and facets for size
and material
are added. The facet for the size
attribute will have the Any
match type, as it does not make sense for a SKU to have multiple sizes. The material
facet has the match type All
, as a customer might want to look for clothes with multiple materials for the same SKU. Alternatively, material
could have the match type None
, if it is necessary to provide the customer with the ability to filter out clothes containing specific materials.
Parameters
Parameters are used to control the sorting of products. A partition is multiplied by a weight and added to a parameter business rule. See commercial properties for more information.
An example of two partition weights could be: Products that are in the 10% most sold products have a weight of 10, and products that are in stock have a weight of 5.
Warning
A max achievable score can be set in the general settings (by default 1000). When set, the sum of all the weights must equal the max achievable score. This score is global for all parameter business rules, and helps to ensure that contextual boosting does not outweigh the search relevance. When users search for products, it is important that they see relevant products. Among these relevant products, the order in which they are displayed may be influenced by commercial sorting.
Product pinning
Product pinning bypasses commercial sorting.
If a search request is sent with pinned ids, these will take priority over saved ids on the business rules.
Each product pinning business rule can have up to 200 pinned products/SKUs.
Relevance boost
Search relevance is used to configure how important a phrase match is compared to other contributions. Often, a match in the name or short description of a product is more important than a match in long description. Also, a match on the product number is often the most important.
It is possible to choose the following weights:
- Very High
- High
- Medium
- Low
Only fields that have been configured as searchable can be assigned a search relevance.
While editing a business rule, a search will show how much it boosts every product, and changes to the Search relevance will affect the live preview immediately.
Publication
Changes to business rules will only take effect after publication. Only active business rules will be used for searches.