--- title: Order of execution of query pipeline features slug: '1376' canonical_url: https://docs.coveo.com/en/1376/ collection: tune-relevance source_format: adoc --- # Order of execution of query pipeline features When a [query](https://docs.coveo.com/en/231/) is sent to your [Coveo organization](https://docs.coveo.com/en/185/), the query goes through a specific [query pipeline](https://docs.coveo.com/en/180/) before reaching the [index](https://docs.coveo.com/en/204/). Within any given query pipeline, the various [query pipeline features](https://docs.coveo.com/en/234/) follow a specific, unchangeable order of execution. > **Note** > > Query pipeline features of the same type are executed in the order they appear on the [rule](https://docs.coveo.com/en/236/)’s configuration page. The following diagram shows the process of a query being sent to a given Coveo organization and the order of execution of query pipeline features. ![diagram showing order of execution](https://docs.coveo.com/en/assets/images/tune-relevance/order-of-execution-query-pipeline-features.png) When a query is sent from a Coveo-powered [search interface](https://docs.coveo.com/en/2741/), which is configured to [route queries to a specific query pipeline](https://docs.coveo.com/en/1666/), the query goes through the following steps: > **Note** > > Before the query enters the query pipeline flow, Coveo ML [Query Suggestions (QS)](https://docs.coveo.com/en/3386/) or [Predictive Query Suggestions (PQS)](https://docs.coveo.com/en/lcee0589/) are displayed to the user as they type their query. . [Query parameter rules](https://docs.coveo.com/en/3411/) are applied. . [Thesaurus rules](https://docs.coveo.com/en/3405/) are applied. > **Note** > > Sometimes, the order in which thesaurus keywords are defined within a thesaurus rule may have an impact on the rule's behavior. > See [Using the `alias` sub-feature](https://docs.coveo.com/en/1442#using-the-alias-sub-feature) for details. . [Stop word rules](https://docs.coveo.com/en/3406/) are applied. . [Filter rules](https://docs.coveo.com/en/3410/) are applied. . [Ranking expression rules](https://docs.coveo.com/en/3375/) are applied. . [Featured results rules](https://docs.coveo.com/en/3376/) are applied. . [Ranking weight rules](https://docs.coveo.com/en/3412/) are applied. . Coveo ML [Content Recommendations (CR)](https://docs.coveo.com/en/3387/) and [Product Recommendations (PR)](https://docs.coveo.com/en/3382/) models are queried. . Coveo ML [Automatic Relevance Tuning (ART)](https://docs.coveo.com/en/3384/) models are applied. . Coveo ML [Intent-Aware Product Ranking (IAPR)](https://docs.coveo.com/en/m5vg6516/) models are applied. . Coveo ML [Dynamic Navigation Experience (DNE)](https://docs.coveo.com/en/3383/) item boosting is applied. . [Trigger rules](https://docs.coveo.com/en/3413/) are applied. . The query is sent to the index in which the query is processed and Coveo ML [Semantic Encoder (SE)](https://docs.coveo.com/en/nb6a0483/) models are applied. . Coveo ML [Dynamic Navigation Experience (DNE)](https://docs.coveo.com/en/3383/) models facet ordering is applied. . Coveo ML [Smart Snippets](https://docs.coveo.com/en/l6eb0531/) models are applied. . Coveo ML [Relevance Generative Answering (RGA)](https://docs.coveo.com/en/n9de0370/) models are applied. ## Example A visitor accesses the Coveo-powered search interface of your bookstore ecommerce website. This search interface is configured to route queries to the **Bookstore Search** query pipeline. . A visitor starts typing the following query: `Harry P`. . The Coveo ML QS (or PQS) model suggests the following query: `Harry Potter novel`, which the visitor selects. The query is now `Harry Potter novel`. . The query pipeline contains the two following **Query parameter** rules: .. Override the [`aq`](https://docs.coveo.com/en/175/) query parameter to `@source==Books` if the query contains `novel`. .. Override the `sortCriteria` query parameter value to `DateAscending` if the advanced query is `@source==Books`. Since the query currently contains `novel`, the rule to override the `aq` query parameter to `@source==Books` applies. Although rule 3.a. sets the `aq` query parameter to `@source==Books`, the advanced query hasn't yet been updated accordingly. Therefore, rule 3.b. doesn't apply. After both **Query parameter** rules have been evaluated: ** The query is still `Harry Potter novel`. ** The advanced query is now `@source==Books`. . The pipeline contains the two following **Thesaurus** rule: Replace `Harry` in the current query with `Harry OR wizard OR Hogwarts OR Gryffindor` if the advanced query is `@source==Books`. As the advanced query is now `@source==Books`, the rule applies. ** The query is now `(Harry OR wizard OR Hogwarts OR Gryffindor) Potter novel`. ** The advanced query is still `@source==Books`. . The pipeline contains the following **Stop word** rule: Remove `Gryffindor` from the current query if the query contains `wizard`. As the query now contains `wizard`, the rule applies. ** The query is now `(Harry OR wizard OR Hogwarts) Potter novel`. ** The advanced query is still `@source==Books`. . The pipeline contains the following **Filters** rule: Add `@author=="J.K. Rowling"` to the `aq` if the advanced query is `@source==Books`. Since the advanced query is `@source==Books`, the rule to add `@source==Books` to the `aq` applies. ** The query is still `(Harry OR wizard OR Hogwarts) Potter novel`. ** The advanced query is now `@source==Books @author=="J.K. Rowling"`. . The pipeline contains the following **Query ranking expressions** rule: Apply a `+500` ranking score boost to items whose `@bookseries` field value is `Harry Potter` if the advanced query contains `@author=="J.K. Rowling"`. As the advanced query contains `@author=="J.K. Rowling"`, the rule applies. While the query and the advanced query remain unchanged, the query now includes a [query ranking expression (QRE)](https://docs.coveo.com/en/1472/). . The pipeline contains the following **Featured result** rule: Pin at the top of the search results the item whose `title` is `Harry Potter and the Philosopher's Stone` if the advanced query contains `@author=="J.K. Rowling"`. As the advanced query now contains `@author=="J.K. Rowling"`, the rule applies. The query and the advanced query remain unchanged, but the query now includes an additional QRE representing the featured result rule. . The pipeline contains the following **Ranking weight** rule: Increase the weight of the `title` ranking factor, and lower the weight of the `summary` ranking factor if the query contains `Gryffindor`. As the query no longer contains `Gryffindor` (it was removed by a **Stop words** rule in step 6), the rule doesn't apply. . No Coveo **ML Content Recommendation (CR)** and **Product Recommendation (PR)** models are configured in the query pipeline as Coveo ML CR and PR models must be configured in separate query pipelines. . The query pipeline contains a Coveo **ML ART** model. Therefore, the model finds the most clicked items for the `(Harry OR wizard OR Hogwarts) Potter novel` query. . The query pipeline contains a Coveo **ML IAPR** model. Therefore, the model embeds the visitor's [user session vector](https://docs.coveo.com/en/nbla0227/) into the product vector space to find the products that are the most relevant to the visitor's current intent. . The query pipeline contains a Coveo **ML DNE** model. Therefore, the model finds the most clicked facet values for the `(Harry OR wizard OR Hogwarts) Potter novel` query, and then applies QREs to boost the search results whose field values match the values of those popular facets. . The pipeline contains the following **Trigger** rule: Send a notification to the end user saying `You're a wizard, Harry!` if the query contains `Hogwarts`. As the query contains `Hogwarts`, the rule applies. . The processed query is sent to the index, which contains a Coveo **ML SE** model. Therefore, the model uses vector search to retrieve the most relevant items that have a high semantic similarity with the `(Harry OR wizard OR Hogwarts) Potter novel` query. The most relevant search results are then sent to the Coveo ML RGA model for answer generation. . Since the query pipeline contains a Coveo **ML DNE** model, the model finds the most relevant facets for the `(Harry OR wizard OR Hogwarts) Potter novel` query and orders them (and their values) to display the most relevant ones first. . The query pipeline contains a Coveo **ML Smart Snippet** model. Therefore, the model extracts the most relevant passages from the most relevant search results for the `(Harry OR wizard OR Hogwarts) Potter novel` query. . The query pipeline contains a Coveo **ML RGA** model. Therefore, based on the search results found by the Coveo **ML SE** model, the model generates the most relevant answers to the `(Harry OR wizard OR Hogwarts) Potter novel` query. . The search results, smart snippets, and generated answers are shown to the visitor in the Coveo-powered search interface.