Associate a Product Recommendation (PR) model with a query pipeline — Coveo Merchandising Hub
Associate a Product Recommendation (PR) model with a query pipeline — Coveo Merchandising Hub
|
Instructions in this article are only relevant for Coveo for Commerce implementations that leverage the Coveo Merchandising Hub (CMH) to manage recommendation slot configurations. If you’re associating a PR model with a query pipeline that serves a recommendation interface that isn’t configured through the CMH, refer to the generic PR model association instructions. |
When associating a PR model with the query pipeline for recommendations, you must configure an association for each of the CMH recommendation strategies you want to use in your storefront. For example, if you use the Most purchased and Viewed together CMH strategies in your storefront, you must configure an association for each of these strategies.
This process involves:
Step 1: Create the query pipeline conditions:
You must create a query pipeline condition for each of the CMH recommendation strategies you want to use in your storefront.
The following table provides the conditions you must create based on the CMH strategy you want to use in your storefront:
CMH strategy | Query pipeline condition |
---|---|
Viewed together |
|
Purchased together |
|
Intent-aware |
|
Most viewed |
|
Most purchased |
|
Recently viewed |
|
Recently purchased |
|
Purchased with recently purchased |
|
Buy again |
|
For each query pipeline condition you configure, take note of the condition ID as you’ll need it when associating the model with the query pipeline. You can find the condition ID in the URL of the Conditions (platform-ca | platform-eu | platform-au) page when accessing the condition in the Coveo Administration Console.

For instructions on how to create query pipeline conditions, see Manage query pipeline conditions.
Step 2: Associate a PR model with the query pipeline for recommendations:
To associate a PR model with a query pipeline, use the JSON editor of the Query Pipelines (platform-ca | platform-eu | platform-au) page in the Coveo Administration Console.
-
In the Coveo Administration Console, access the Query Pipelines page.
-
In the Query Pipelines page, click the query pipeline you configured for recommendations, and then click Edit components.
-
Click the Machine Learning tab, and then click the ellipsis in the upper right part of the page to select Associate a model in JSON view.
-
In the JSON editor, add the following configuration, replacing the placeholder values with your data, and then click Associate model.
{ "modelId": "<MY_MODEL_ID>",
"condition": "<MY_CONDITION_ID>",
"maxRecommendations": 50, "cacheMaximumAge": "<CACHE_MAXIMUM_AGE>",
"exclusive": true, "customQueryParameters": { "strategy": "<STRATEGY_VALUE>"
}, "useAdvancedConfiguration": true }
Replace <MY_MODEL_ID> with the ID of the model you want to associate with the query pipeline.
See Review model information to learn how to find the model ID. |
|||||||||||||||||||||
Replace <MY_CONDITION_ID> with the ID of the query pipeline condition you created for the strategy you want to associate the model with. |
|||||||||||||||||||||
When associating an SBPR model, we recommend adjusting the default value of PT10S to a shorter duration between 0 and 5 seconds (that is, PT0S to PT5S ).
This adjustment ensures the model responds more quickly to user behavior.
Note that the value must be in the ISO-8601 format. |
|||||||||||||||||||||
Replace <STRATEGY_VALUE> with the the strategy you want to associate the model with.
The following table provides the strategy values for each CMH strategy:
|