--- title: Case Deflection component slug: l54d0097 canonical_url: https://docs.coveo.com/en/l54d0097/ collection: coveo-for-zendesk source_format: adoc --- # Case Deflection component To augment [case deflection](https://docs.coveo.com/en/2911/), the Coveo Case Deflection component lets you display relevant content that dynamically changes depending on the content of a request. > **Note** > > The Coveo Case Deflection component requires Zendesk v0.0.2 or later. ## Use the Coveo Case Deflection component For steps on accessing the folders in the Customize design window of Zendesk, see [**Customizing your help center theme**](https://support.zendesk.com/hc/en-us/articles/203664326). 1. Go to your theme customization page and click **Edit Code**. 2. Locate the page template that corresponds to the new request page (generally `new_request_page.hbs`). 3. Enter your page template code where indicated in the code block. ```html ``` ## Use Coveo hosted search pages for case deflection The Coveo Case Deflection component can be used in conjunction with the [Coveo Hosted Search Page component](https://docs.coveo.com/en/l54d0229/). To do so, replace your page template with the Coveo Hosted Search Page component. ```html ``` When you save and reload the page, you'll see the results displayed on your new request page. > **Note** > > For increased accessibility, you can modify the layout to display the form and the results side by side. For example: > > [.highlight] > ```html
{{request_form}}
``` ## Filter results with request context Once the component is in place, you can see additional context sent with every Coveo [query](https://docs.coveo.com/en/231/) request. Upon opening the browser developer tool, you can locate a REST query going to `https://platform.cloud.coveo.com/rest/search/v2`. By scrolling to the bottom, you'll see the `context` parameter. This parameter sends a JSON with the attributes of the request and should look like this: ```json context: {"subject":"Issues with my widget","description":"My widget is broken"} ``` The keys in this JSON are useful for [configuring your Case Deflection component](#configure-your-case-deflection-component) where you'll configure your [query pipeline](https://docs.coveo.com/en/180/). Any key in this JSON can be used in your query pipeline. For example: ```json $context.subject ``` ## Configure your Case Deflection component . In your [Coveo organization](https://docs.coveo.com/en/185/), select or create the query pipeline used by your Case Deflection component. . On the **Machine learning** tab, add a new [Coveo ML](https://docs.coveo.com/en/188/) [model](https://docs.coveo.com/en/1012/), such as an [Automatic Relevance Tuning (ART)](https://docs.coveo.com/en/1013/) model, with the **Enable Intelligent Term Detection (ITD)** option selected. See [Configure an Automatic Relevance Tuning model for Case Deflection or Case Assist Document Suggestions](https://docs.coveo.com/en/lc8b0514/) for instructions on how to create a Coveo ML ART model that's optimized for case deflection. . On the **Query Parameters** tab, add rules overriding the [basic query expression (`q`)](https://docs.coveo.com/en/178/) and the [large query expression (`lq`)](https://docs.coveo.com/en/214/) parameter values: .. Click **Add a query parameter rule**. .. On the **Add a query parameter rule** subpage, select **q (basic query expression)**, and then click **Next**. .. Under **q (basic query expression)**, enter the following expression: `<@+ $context.subject +@>`. > **Important** > > If you enabled the [query syntax](https://docs.coveo.com/en/1552/) in your Case Deflection component, you must remove the `<@+` and `+@>` markers from the query parameter rule overriding the [basic query expression (`q`)](https://docs.coveo.com/en/178/). > When the query syntax is enabled, enter the following rule: > > `$context.subject` .. Under **Condition**, select or [create](https://docs.coveo.com/en/1959#create-a-condition) a `Query is empty` condition. .. Click **Add rule**. .. To add a rule to override the `lq` parameter value, click **Add a query parameter rule** once again. .. On the **Add a query parameter rule** subpage, select **lq (large query expression)**, and then click **Next**. .. Under **lq (large query expression)**, enter the following expression: `<@+ $context.description +@>`. .. Under **Condition**, select or [create](https://docs.coveo.com/en/1959#create-a-condition) a `Query is empty` condition. .. Click **Add rule**.