Manage Trigger Rules
Members with the required privileges can use query pipeline triggers to define an action to execute in a search interface when a query meets the associated condition.
The list of query pipeline triggers for a Coveo organization is empty by default.
When a trigger rule is applied, an object representing the action to perform is generated inside the triggers
property of the query response.
The search interface from which the query originates is then responsible for translating this object into an action (e.g., executing a corresponding JavaScript function call, notifying the end user with a corresponding message, etc.).
In a full Coveo JavaScript Search Framework interface, you use the To use the
Since the March 2020 Release (v2.8521), standalone search boxes automatically handle Redirect triggers without the need for a |
Create Trigger Rules
-
On the Query Pipelines page, click the query pipeline in which you want to add a rule, and then click Edit components in the Action bar.
-
On the page that opens, select the Advanced tab.
-
In the Advanced tab, on the left-hand side of the page, select Triggers.
-
In the upper-right corner of the page, click Add Rule to access the Add a Trigger Rule [1] subpage.
-
Under Type, select one of the available methods (Notify, Query, Execute, or Redirect).
-
In the box that opens, depending on the selected method, enter the desired value.
-
On the right-hand side, under Condition, select a query pipeline condition in the drop-down menu or create a new one.
If a trigger rule isn’t associated with a query pipeline condition, the rule is ignored.
-
Under Description, optionally enter information that will help you manage the rule in the future.
-
Click Add Rule.
Edit Trigger Rules
-
On the Query Pipelines page, click the query pipeline in which you want to edit a rule, and then click Edit components in the Action bar.
-
On the page that opens, select the Advanced tab.
-
In the Advanced tab, on the left-hand side of the page, select Triggers.
-
Click the rule you want to edit, and then click Edit in the Action bar [2] to access the Edit a Trigger Rule subpage.
-
Under Type, select one of the available methods (Notify, Query, Execute, or Redirect).
-
In the box that opens, depending on the selected method, enter the desired value.
-
On the right-hand side, under Condition, select a query pipeline condition in the drop-down menu or create a new one.
If a trigger rule isn’t associated with a query pipeline condition, the rule is ignored.
-
Under Description, optionally enter information that will help you manage the rule in the future.
-
Click Save.
Duplicate Trigger Rules
-
On the Query Pipelines page, click the query pipeline for which you want to duplicate query pipeline rules, and then click Edit components in the Action bar.
-
On the page that opens, select the Advanced tab.
-
In the Advanced tab, on the left-hand side of the page, select Triggers.
-
In the Triggers subtab, click the rule you want to duplicate within the same pipeline (typically to create a slightly different rule).
-
In the Action bar, click Duplicate.
The duplicated rule appears at the bottom of the list in the pipeline component tab.
Review Information About the Rule’s Creation or Last Modification
You can verify who created or last modified a given trigger rule by inspecting the Details column of the Triggers subtab. The Details column also indicates the hour and date the rule was created or last modified.
-
On the Query Pipelines page, click the query pipeline containing the rule for which you want to inspect the information of the Details column, and then click Edit components in the Action bar.
-
On the page that opens, select the Advanced tab.
-
In the Advanced tab, on the left side of the page, select Triggers.
-
In the Triggers subtab, inspect the information of the Details column for the desired rule.
Delete Trigger Rules
-
On the Query Pipelines page, click the query pipeline for which you want to delete query pipeline rules, and then click Edit components in the Action bar.
-
On the page that opens, select the Advanced tab.
-
In the Advanced tab, on the left-hand side of the page, select Trigger.
-
In the Trigger subtab, click the rule you want to delete.
-
Click Delete to confirm.
Change the Rule Order
Query pipeline rules are executed in the order in which they appear on the page until a condition is satisfied.
-
On the Query Pipelines page, click the query pipeline for which you want to manage the rules' execution order, and then click Edit components in the Action bar.
-
On the page that opens, select the Advanced tab.
-
In the Advanced tab, on the left-hand side of the page, select Triggers.
-
In the Triggers subtab, click the rule whose position you want to change.
-
In the Action bar, click Move up or Move down to change the position of the rule.
Reference
Methods
When managing trigger rules, you can select one of the following trigger types:
Notify
When creating or editing a Notify trigger rule, in the String box, enter a message to display in the search interface.
On your internal search page for parts, each time a query is performed without a model number, you want to show Add a model number to your query
to the user.
Query
When creating or editing a Query trigger rule, in the Query box, enter a query to perform as a new search in the search interface.
This method can be used as a custom |
Execute
When creating or editing an Execute trigger rule, in the Function box, enter a JavaScript function to execute in the user’s browser.
-
You recently deprecated the ACME CTRLR product, but realize that your support agents still search for it. To make sure that all your agents are aware of that recent change, you configured the
deprecatedProduct()
JavaScript function in your search interface to ask them to confirm their query when they’re about to send theACME ctrlr
query:function deprecatedProduct() { var currentQuery = Coveo.state(Coveo.$$(document).find("#search"), "q"); confirm("The '" + currentQuery + "' product has been deprecated. Are you sure you want to continue?"); };
Since you want this function to execute only when the
ACME ctrlr
query is sent, you configure an Execute trigger rule that targets thedeprecatedProduct()
function and that executes only when a user sends theACME ctrlr
query. -
A user searches
webcam
. Since this query can refer to any model, you create a function to generate a carousel of webcams each timewebcam
is queried, and then let the user select the one they’re looking for. -
You want a box to appear at the top of the search results when users search for the name of a product. This box contains a download link and links to the product documentation guides.
Redirect
When creating or editing a Redirect trigger rule, in the URL box, enter a URL to redirect the user.
For certain queries, you always want a specific web page to be opened. A user searching find stores
is automatically redirected to your Store Finder page instead of being shown search results that contain the phrase find stores
.
QPL Syntax
Use the following query pipeline language (QPL) syntax to define a trigger rule:
execute <function> | notify <message> | query <expression> | redirect <url>
<function>
A string that contains the JavaScript function call to execute (e.g., myFunction()
). Boolean, integer, and quoted string function arguments are allowed.
When specifying a function containing arguments (e.g.,
Therefore, the corresponding function must be implemented accordingly on client-side. For example, if the trigger expression is
|
<message>
A quoted string that contains a message to display to the end user (e.g., "Hello world!"
).
<expression>
A query expression to perform against the index (e.g., coveo OR "machine learning"
).
<url>
A quoted string that contains a URL to which the browser is redirected (e.g., "http://www.example.com"
).
Order of Execution
The following diagram illustrates the overall order of execution of query pipeline features:

Required Privileges
By default, members of the Administrators and Relevance Managers built-in groups can view and edit elements of the Query Pipelines page.
The following table indicates the required privileges to view or edit elements of the Query Pipelines page (see Manage Privileges and Privilege Reference).
Action | Service - Domain | Required access level |
---|---|---|
View trigger |
Search - Query pipelines |
View |
Edit trigger |
Search - Query pipelines |
Edit |
