--- title: Using Query Suggestions (QS) in Coveo for Commerce slug: p26b0268 canonical_url: https://docs.coveo.com/en/p26b0268/ collection: coveo-for-commerce source_format: adoc --- # Using Query Suggestions (QS) in Coveo for Commerce [Coveo Machine Learning (Coveo ML)](https://docs.coveo.com/en/188/) [Query Suggestion (QS)](https://docs.coveo.com/en/1015/) [models](https://docs.coveo.com/en/1012/) recommend relevant [queries](https://docs.coveo.com/en/231/) to visitors as they type in the search box. The model suggests queries based on the characters typed, prioritizing those that have been searched most frequently and resulted in the most clicks in the past. > **Important** > > If you use the [Catalog source](https://docs.coveo.com/en/l5if0244/) to index your [catalog data](https://docs.coveo.com/en/obcf0333/), we recommend that you use [Predictive Query Suggestions (PQS)](https://docs.coveo.com/en/lcee0589/) instead of QS. > > Unlike Coveo ML QS [models](https://docs.coveo.com/en/1012/), which generate suggestions based on query-click patterns, PQS [models](https://docs.coveo.com/en/1012/) leverage Coveo's [product embeddings and vector](https://docs.coveo.com/en/l9gg3565/) capabilities. > Leveraging these capabilities allows PQS [models](https://docs.coveo.com/en/1012/) to detect [visitors](https://docs.coveo.com/en/nbub9475/)' shopping objectives and react to intent changes in real time. > This means that PQS [models](https://docs.coveo.com/en/1012/) can suggest [query](https://docs.coveo.com/en/231/) candidates that are tailored to the current [visitor](https://docs.coveo.com/en/nbub9475/)’s shopping context, whether they're authenticated or not. ## Prerequisites To leverage Coveo ML QS in your Coveo for Commerce implementation, make sure that: * The search interface where you want to integrate the model logs click events (see [Log commerce events](https://docs.coveo.com/en/3188/)). * If your Coveo for Commerce implementation targets the Search API to handle search queries, the interface where you want to integrate the model [logs search events](https://docs.coveo.com/en/n7o80165/). ** If you're targeting the Commerce API to handle search queries, as well as the [Event Protocol](https://docs.coveo.com/en/o9je0592/) to log events, search events are automatically logged using the information of the API request. ** If you're using the Commerce API to handle search queries, but use the Coveo UA Protocol to log events, the interface where you want to integrate the model must [log search events](https://docs.coveo.com/en/n7o80165/). * You use a [tracking ID](https://docs.coveo.com/en/o8rb0139/) to identify the [storefront](https://docs.coveo.com/en/p33g0410/) where you want to integrate the model. ## Model creation When creating a QS model for Coveo for Commerce, you must ensure that the model is configured to learn from the data of the [storefront](https://docs.coveo.com/en/p33g0410/) where it's deployed. . [Create a QS model](https://docs.coveo.com/en/3398#create-a-qs-model). . Once you created the model, [configure learning filters](#configure-learning-filters) to ensure that the model only uses the data that's relevant to the website on which it's deployed. ### Configure learning filters When using QS [models](https://docs.coveo.com/en/1012/) for a Coveo for Commerce [organization](https://docs.coveo.com/en/185/), you must configure learning filters to ensure that the model only uses the data that's relevant to the website on which it's deployed. To configure learning filters: . Once you've created your model, access the [**Models**](https://platform.cloud.coveo.com/admin/#/orgid/ai-and-ml/models/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/ai-and-ml/models/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/ai-and-ml/models/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/ai-and-ml/models/)) page. . Click the desired model, and then click **More** > **Edit JSON** in the Action bar. . In **Edit a Model JSON Configuration**, add the following `commonFilter` object: ```json "commonFilter": "(trackingId=@'')" ``` Where you replace `` with the [tracking ID](https://docs.coveo.com/en/o8rb0139/) (registered as properties in your Coveo organization) defined for the website on which you want to use the model. . Click **Save**. **Example** If you have a model that you want to use on a website for which the registered [tracking ID](https://docs.coveo.com/en/o8rb0139/) is `barca_sports_us`, your JSON configuration should look like this: ```json { "modelDisplayName": "Barca Sports US - QS", "exportPeriod": "P3M", "intervalTime": 1, "intervalUnit": "WEEK", "commonFilter": "(trackingId=@'barca_sports_us')", "exportOffset": "PT0S" } ``` ## What's next? Once you've created and configured your QS model, you must [associate it](https://docs.coveo.com/en/l1mf0321/) with the [query pipeline](https://docs.coveo.com/en/180/) [that was created](https://docs.coveo.com/en/o48e0216#storefront-associations-and-query-pipelines) for the Search product discovery solution.