Business RulesOverview
Business rules are manually-created formulas for rewriting queries. This is the most versatile strategy for creating custom query rewrites. It supports a variety of conditions and actions to address a wide range of use cases. When you need a very specific query rewrite, this is the best strategy.
Business rules are applied in the Apply Rules stage of the query pipeline.
To learn how to use business rules in the Rules Editor, see Use Business Rules in the Rules Editor.
Configuration options
General
General configurations are used to characterize a rule, including its name, description, group, and more. They are also used to set a rule’s precedence, or priority over other rules.
For complete details, see General Configurations.
Condition
Conditions, or triggers, define the environment necessary for the rule action to fire. Any combination of conditions (date, field value, query, and query profile) can be defined for a rule.
For complete details, see Conditions.
Custom Rule Actions
Custom rule actions allow you to define a unique action to take when certain conditions are met. They involve three primary components: a query pipeline, a custom rule type, and a rule that is triggered by conditions defined by the user.
For complete details, see Custom Rule Actions. To learn use custom rule actions with the API, see Create Custom Rule Actions with the API.
Query Elevation Component
Fusion currently supports the use of the Query Elevation Component (QEC) with boost lists and filter lists. You must configure Solr in order to enable the QEC option.
For instructions about using the QEC, see Use the Query Elevation Component.
Additional details
Query pipeline stages for rules
These stages are part of the default query pipeline:
-
This stage looks up rules that have been deployed to the
COLLECTION_NAME_query_rewrite
collection and matches them against the query. Matching rules that perform query rewriting are applied at this stage, while matching rules that perform response rewriting are applied by the Modify Response with Rules stage later in the pipeline.
To trigger a rule that contains a tag, specify the tagname in the request URL of the user search app. See Easily define triggers in tags for more information. |
-
Most rules operate on the request, but some rule types, such as banner rules or redirect rules, do their work when the response comes back. The Modify Response with Rules stage applies those rules to the response. For example, a banner rule can add a banner URL to the response before returning it to the client.
Generally, if you are using rules, you need both of these stages enabled in your query pipeline. The Apply Rules stage must come before the Solr Query stage, while the Modify Response with Rules stage must come after the Solr Query stage. Disabling or removing the Apply Rules stage will disable rules entirely. Disabling or removing the Modify Response with Rules stage will disable only the rules that perform response rewriting, if any.
Rules on response signals
Response signals capture a list of rule IDs that match the query in a multi-valued field named rule_ss
.
This allows for downstream analysis on rule activity using SQL, App Insights, or a custom Python job.
Rules and experiments
The easiest way to integrate rules and experiments is to create one query pipeline with rules enabled and one without. Keep all other settings constant between the two pipelines. The pipeline without rules enabled must be configured manually.
To create an experimental rule, use tags on the rule and set the tag in one of the variant pipelines.
FAQ
Arbitrary values are values that are not actively used by Fusion. Instead, they are used by the user or the search application. For example, the Description is considered an arbitrary value, as it serves only to inform the user what the business rule is used for.
Additional resources
-
View our training on Query Rewriting with Business Rules and Search Rewrites.