Contextual rules refer to the business rules that are defined by utilizing the context information available to SearchAssist. These rules can be used to tailor the response based on factors like recent search queries, user context, page context, etc.
You can define contextual business rules for both Search Results as well as Answers. Business rules for Answers and Business rules for Search results are differentiated by the name of the rule.
Add a Contextual Rule
To add a new rule, go to the Business Rules page under the Indices tab and click Add Contextual Rule.
To define a business rule, you need to specify a name, the condition under which the rule is to be applied, and the outcome of the rule and click Add.
Rule Name – Give a unique name for the rule.
Note that the Business rules for Answers and Business rules for Search results are differentiated by the name of the rule. You can use any name for a rule to be applied to Search results but for rules to be applied to Answers, the name should begin with ‘vi_’.
Condition: Condition defines the trigger for the rule to be applied. For contextual rules, conditions are based on the different types of context information available and the parameter values set. Three types of context can be used to define a condition.
- Search context This is based on the user search history. This context gives access to information like Recent search queries, current search query, and Traits.
- Page context This gives context information from the device, browser, or the current page.
- User Context This can be used to fetch context information about a user. You can pass any custom fields as parameters.
Using the selected context and parameters, you can define a condition. You can add more than one condition to refine the conditions further.
Outcome: Outcome defines what happens when the above conditions are met. Choose the actions you wish to take and the response you want to give to the users for the specified conditions or queries.
The Action field can take the following values:
Field | Description |
Boost | Prioritize the search results by the boost factor. The boost factor can take values between 1 and 5, where 5 being the maximum boost and 1 being the lowest. |
Lower | De-prioritize the search results by the lower factor. This factor can take values between 1 and 5. |
Hide | Hide the response from the search results |
Filter | Filter the search results as per the response |
Use the response section to describe the set of results on which the Action is to be taken. Select the field on which you want to apply the action chosen above. Then, specify the condition and a value of the field that will be used to identify the records to be displayed in the results. The value can be set to a static value or can be mapped to a dynamic value.
- Static: When providing a constant value for a field.
- Dynamic: When providing a value fetched dynamically from searchContext, userContext, or pageContext.
For instance, if you consider individuals seeking credit card information as prospective credit card customers, and you aim to enhance the visibility of pages that outline the benefits and promotions linked to credit cards to such users. In this situation, you can define a business rule as shown below.
Enable/Disable a Contextual Rule
After defining a rule, you need to activate it to put it into effect in the search results. Similarly, you can temporarily deactivate it to not affect the search results. To change the status of the rule, go to the list of rules and use the slider button to change the status. Alternatively, go to the edit page for the rule and use the slider button at the top to change the status of the rule.
Edit Contextual Rule
To edit an existing rule, go to the list of rules under Business Rules and use the edit icon against the rule to be edited. You can modify all the fields in the rule as a new rule.
Delete Contextual Rule
To delete an existing rule, go to the list of contextual rules and use the delete icon against the rule to be deleted. To delete multiple rules at once, select the rules to be deleted and click the Delete button on the top right corner of the page.
Examples of using Contextual Rules
In a banking scenario, suppose you want to achieve the following:
- Present premium customers with a credit card offer.
- If a customer is not creditworthy, do not show them loan offers.
- If the user has only a savings account and is searching for account-related information, do not show information related to other types of accounts.
In such a scenario, you can set the following rules corresponding to each of the above requirements and offer the desired search results.
- When customerType is ‘Premium’ and his recent search queries include words like ‘credit’,’card’,etc, boost the pages which list the credit card offers and rewards.
- When the credit score of a customer is not good and recent search history indicates his need for a loan, hide the pages which list loan or credit card offers.
- When a user with a debit card from the bank is looking for debit card offers, promote credit card offerings.