Query Pipeline Management
- What Is a Query Pipeline
- Routing Mechanisms and Rules
- Deployment Overview
- Order of Execution of Query Pipeline Features
- Troubleshooting Query Pipeline Rules
- Coveo ML Model Association Management
- Thesaurus Rule Management
- Featured Results Rule Management
- Stop Words Rule Management
- Ranking Expressions Rule Management
- Ranking Weights Rule Management
- Triggers Rule Management
- Filters Rule Management
- Query Parameters Rule Management
- Query Pipeline Rule Management
- Coding Query Pipeline Rules
- Testing Changes
- Exporting and Importing Query Pipeline Elements
Query Pipeline Routing Mechanisms and Rules
All queries sent to your Coveo Cloud organization are routed to a query pipeline before they reach the index (see What Is a Query Pipeline?). Depending on your needs, you can leverage different query pipeline routing mechanisms.
Usually, you will want to use condition-based routing to take advantage of the flexibility offered by query pipeline conditions (see Condition-Based Routing (Recommended)). However, some situations may require you to enforce a specific routing, ignoring query pipeline conditions altogether (see Search Interface-Enforced Routing and Search Token-Enforced Routing).
The following table summarizes the main criteria to consider when selecting a query pipeline routing mechanism.
|Selection criteria||Query pipeline routing mechanisms|
|Condition-based routing1||Search interface-enforced routing||Search token-enforced routing|
|Implementation by||Coveo Cloud administrator||Developer||Developer|
|Implementation in||Coveo Cloud administration console
(no code required)
|Search interface configuration
|Search token generation logic
Note 1: Recommended.
Review the following leading practices and rules to better understand how queries are routed to a given query pipeline, and determine which routing mechanism best suits your needs.
The following diagram and rules describe the routing rules.
When your setup uses search tokens for authentication, a query pipeline can be specified in each generated token (see the
pipelineparameter), in which case that query pipeline is used, bypassing its condition (if any).
Search token-enforced routing takes precedence over all other query pipeline routing mechanisms.
You can validate whether a search token enforces a query pipeline by decoding this search token with a tool such as JWT.IO.
SearchInterfacecomponent), this query pipeline is used, bypassing its condition (if any).
Search interface-enforced routing takes precedence over condition-based routing.
defaultvalue on the
pipelineoption when none was set on the
SearchInterfacecomponent, thus overwriting any condition set on the administration console Query Pipelines page.
When the query pipeline is not enforced by the search token or by the search interface, for each query:
Starting with the oldest query pipeline with a condition, and then proceeding on chronologically, the Search API evaluates query pipeline conditions against the query. Query pipelines without a condition are ignored.
If the query satisfies a query pipeline condition, that query pipeline is used. Remaining query pipeline conditions are not evaluated.
If the query satisfies no single query pipeline condition, the query pipeline is used, bypassing its condition (if any).
- A query can only be routed to a query pipeline that has no condition when that query pipeline is enforced by the search token or by the search interface.
- In the Coveo Cloud administration console, query pipelines are sorted alphabetically, and cannot be sorted by creation or last modification date. The actual order of evaluation of query pipeline conditions should thus be considered unpredictable, reinforcing the recommendation that you should set mutually exclusive query pipeline conditions.
Condition-Based Routing (Recommended)
Condition-based routing is the most flexible query pipeline routing mechanism. This mechanism does not normally require you to modify a single line of code; you can alter query pipeline routing rules by modifying conditions from the Coveo Cloud administration console (see Adding and Managing Query Pipeline Conditions).
Consider the following leading practices when using the condition-based query pipeline routing mechanism:
Ensure that no query pipeline is enforced by the search interface or search token (see Determining if a Query Pipeline Is Hardcoded).
The condition on a query pipeline enforced by the search interface or search token is ignored (see Routing Rules).
Set mutually exclusive conditions on each query pipeline. A good practice is to base the condition of each query pipeline on a unique search hub value. The query pipeline should typically have no condition.
Set the tag on a query pipeline containing rules that are suitable for all kinds of queries sent to your Coveo Cloud organization (see Set a query pipeline as the default one).
Only one query pipeline can have the tag.
While setting a condition on the default query pipeline is possible, this condition will be bypassed if a query fails to satisfy all query pipeline conditions.
You cannot delete the default query pipeline without first setting another query pipeline as default.
Delete unused query pipelines.
In a usage analytics report, you can configure cards with the Query Pipeline, Search Origin 1 (page/hub), and Search Origin 2 (tab/interface) dimensions and the Search Event Count metric to see which page/hub/tab/interface uses which query pipeline.
Search Interface-Enforced Routing
Consider using the search interface-enforced routing mechanism only when you want to:
Control query pipeline routing through client-side logic in your search interfaces.
Bypass the condition-based query pipeline routing mechanism.
The search interface-enforced query pipeline routing mechanism should not be considered any more “secure” than condition-based routing.
Users could still bypass search interface-enforced query pipelines (e.g., by interacting with the search interface programmatically, or by making their own HTTP requests against the Search API).
Search Token-Enforced Routing
Consider using the search token-enforced routing mechanism only when you want to:
Control query pipeline routing through the server-side logic that generates search tokens for your solution.
Bypass all other query pipeline routing mechanisms (i.e., condition-based and search interface-enforced). This can be useful in specific cases (e.g., if you are using query pipelines to enforce rules or filters for “security” reasons).
When authenticating a query with a search token, the
pipeline argument set on that token (if specified) takes precedence over the possible output of all other query pipeline routing mechanisms.
For instance, if you specify a
searchHub in a search token that enforces a query pipeline, this
searchHub will not affect the query pipeline routing in any way. The enforced
pipeline will be used even if a query pipeline condition is based on the specified
searchHub in your Coveo Cloud organization (see Search Hub Condition). However, the
searchHub will still be used for usage analytics and Coveo ML purposes.