> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Results and page concepts

> Experience Optimizer

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

export const InlineImage = ({src, alt = '', height = '2em'}) => {
  return <img src={src} alt={alt} style={{
    display: 'inline',
    verticalAlign: 'start',
    height: height,
    margin: '0'
  }} />;
};

[localhost link]: http://localhost:3000/docs/lucidworks-search/07-improve-your-queries/curate-search-experience/experience-optimizer/results-and-page-concepts

[mintlify link]: https://doc.lucidworks.com/docs/lucidworks-search/07-improve-your-queries/curate-search-experience/experience-optimizer/results-and-page-concepts

[old doc.lw link]: https://doc.lucidworks.com/managed-fusion/5.9/t29qwx

This topic provides information about page components you can manage to improve query results in Experience Optimizer.

<LwTemplate />

## Document grouping

Experience Optimizer lets you define categories and group documents that are relevant to each other.

<img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-result-list.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=3eb3b406d5a2114c4881e827fad2ead4" alt="result list" width="1101" height="544" data-path="assets/images/experience-optimizer/eo-result-list.png" />

Options to group documents include:

* Block or boost. For example, promote a new document group to the top of the results for greater visibility.
* Apply rules individually to documents within a group. For example, boost ballet-related documents to the top of the group if a specific user searches for ballet dance contest.

<img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-boost-ballet.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=6d4e81db2dc41eb3acaa58ac61a52c98" alt="ballet boost" width="1104" height="699" data-path="assets/images/experience-optimizer/eo-boost-ballet.png" />

### Best practices

These parameters group documents, and are defined in the Additional Query Parameters Stage:

| Parameter Name | Parameter Value | Update Policy |
| -------------- | --------------- | ------------- |
| group          | true            | default       |
| group.format   | grouped         | default       |
| group.ngroups  | true            | default       |
| group.field    | style\_id\_s    | default       |

For more information about adding a query pipeline and additional query parameters, see:

* **Add a Query Pipeline Stage**
* [Additional Query Parameters Stage](/docs/lucidworks-search/09-developer-documentation/config-specs/query-pipeline-stages/additional-query-parameters)

<Accordion title="Add a Query Pipeline Stage">
  In the Query Workbench, click **Add a Stage** to add query pipeline stages that can perform query setup, results relevancy, troubleshooting, and more.

  <img src="https://mintcdn.com/lucidworks/l9y7VqRhZkN9hmR0/assets/images/4.0/query-workbench-stage-add.png?fit=max&auto=format&n=l9y7VqRhZkN9hmR0&q=85&s=a99d1f4ca656cb61e804ca149e0463e7" alt="Add a stage" width="972" height="840" data-path="assets/images/4.0/query-workbench-stage-add.png" />

  The Solr Query stage is the only pipeline stage that is required for querying processes to complete, and therefore exists in every query pipeline. It is always the last stage in a series.

  **See these pages for more information:**

  * [Query Workbench](/docs/lucidworks-search/05-move-data-out/query-workbench/overview)
  * [Query Pipeline Stages](/docs/lucidworks-search/05-move-data-out/query-pipeline/query-pipeline-stages)
  * [Solr Query stage](/docs/lucidworks-search/09-developer-documentation/config-specs/query-pipeline-stages/solr-query)
</Accordion>

### Collapse/Expand parser grouping

The Collapse/Expand parser allows grouping with the following parameters:

| Parameter Name  | Parameter Value |
| --------------- | --------------- |
| expand          | true            |
| enableElevation | true            |
| group           | false           |

<Note>
  See [Collapse and Expand Results](https://solr.apache.org/guide/collapse-and-expand-results.html) for more information.
</Note>

## Search rewrites

Search rewriting lets you modify search queries to more accurately reflect the intentions of your customers.

These functions let you:

* Create search rewrites manually.
* Edit, test, review and publish the search rewrites generated automatically from signals data.

For example, create a misspelling search rewrite to correct common spelling mistakes entered for a particular document. The misspelled query will then produce the same results as a correctly spelled search.

Experience Optimizer provides four rewrite types:

* **Head/Tail** - improves poorly performing searches.
* **Misspelling detection** - corrects common spelling mistakes.
* **Phrase detection** - identifies products with matching phrases.
* **Synonym detection** - includes alternative words with the same meaning.

<Accordion title="Use Experience Optimizer query rewrites">
  You can create query rewrite rules in Experience Optimizer. This is similar to using the Rules Editor to create query rewrite rules, except there are additional options in Experience Optimizer.

  1. In Lucidworks Search, navigate to **Relevance** > **Rules** > **Optimizer**.
  2. Enter a search term or phrase in the search bar.
  3. Click **Start Task**.
  4. Hover your cursor next to the query. A **+** button will appear: <InlineImage src="/assets/images/predictive-merchandiser/buttons/query-rewrite-add-button.png" alt="Add query rewrite" />
  5. Click the **+** button. A list of query rewrites options will appear: [Head/Tail](#head-tail), [Misspelling](#misspelling), [Phrase](#phrase), [Synonym](#synonym), and [Remove Words](#remove-words).
  6. Click on the type of rule you’d like to configure.

  ## Head/Tail

  You can create a Head/Tail rewrite to improve search results using methods other than correcting for misspellings or synonym expansion. When a poorly defined search term is identified, the original term is replaced by an improved search term.

  For example, a search for `benefits enrollment` could be improved by using the search term `benefits enrollment+year:"2021"` (in this case making use of the year field in the data).

  Most Head/Tail rewrites are typically created automatically via machine learning. However, if desired, custom rewrites can be manually created using the following steps.

  1. From the list of query rewrite options, select **Head/Tail**. A form will appear:

       <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-headtail.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=e675336ae58368ec81acbdca9ca35fc0" alt="Create head/tail query rewrite" width="310" height="494" data-path="assets/images/experience-optimizer/eo-query-rewrite-headtail.png" />

     This form contains the following fields:

     |                |                                                                            |                                   |
     | -------------- | -------------------------------------------------------------------------- | --------------------------------- |
     | Parameter      | Description                                                                | Example Value                     |
     | Tail Query     | The tail query itself.                                                     | `benefits enrollment`             |
     | Improved Query | The query that will replace the tail query phrase.                         | `benefits enrollment+year:"2021"` |
     | Tags           | Optional metadata tags that can be used to identify and organize rewrites. | `enrollmentpacket`                |
  2. Enter one or more improved search terms in the **Improved Query** field.
  3. Click the **Save** button.

  The search is re-run using the improved search term, and a Search box information panel drops down to show that the new query rewrite has fired:

  <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-headtail-results.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=a1d5cab15d47c3ebe8d6bd36bc25485d" alt="Head/tail rewrite results" style={{ width: "500px" }} width="925" height="290" data-path="assets/images/experience-optimizer/eo-query-rewrite-headtail-results.png" />

  ## Misspelling

  You can create a misspelling query rewrite to detect and correct common spelling mistakes. When a customer enters a search term containing a known misspelling, the incorrect spelling is replaced with the spelling correction.

  {/* // NOTE: The example does not match the image. Use another datasource. */}

  For example, if your clients frequently misspell or mistype the word `questionnaire` as `questionare`, you can set up a query rewrite to automatically correct it.

  1. From the list of query rewrite options, select **Misspelling**. A form will appear:

       <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-misspelling.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=faa82678e3b9f4012bdd6cdc0c724e8d" alt="Create misspelling query rewrite" width="312" height="534" data-path="assets/images/experience-optimizer/eo-query-rewrite-misspelling.png" />

     {/* // NOTE: The examples in table do not match the image. Use another datasource. */}

     This form contains the following fields:

     |                 |                                                                                                                                                                                                                             |                    |
     | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
     | Parameter       | Description                                                                                                                                                                                                                 | Example Value      |
     | Misspelled Term | The phrase itself.                                                                                                                                                                                                          | `questionare`      |
     | Corrected Term  | The term that will replace the misspelled term.                                                                                                                                                                             | `questionnaire`    |
     | Action          | Action to perform.                                                                                                                                                                                                          | `expand`           |
     | Confidence      | Confidence score from the phrase job. A confidence level of `1` represents 100% confidence. For rules created automatically via machine learning, the confidence level reflects the output from the machine learning model. | `1`                |
     | Tags            | Optional metadata tags that can be used to identify and organize rewrites.                                                                                                                                                  | `enrollmentpacket` |
  2. Enter one or more spelling corrections in the **Corrected Term** field.
  3. Click the **Save** button.

  The search is re-run using the corrected spelling, and a Search box information panel drops down to show that the new query rewrite has fired:

  <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-misspelling-results.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=f334162a4444e29112112f3b866ddb9d" alt="Misspelling rewrite results" style={{ width: "500px" }} width="921" height="280" data-path="assets/images/experience-optimizer/eo-query-rewrite-misspelling-results.png" />

  ## Phrase

  You can use query rewriting to identify phrases used in search terms so that products with matching phrases are boosted in the search results. This is helpful when users do not use quotation marks to identify phrases in their search terms.

  {/* // NOTE: The example does not match the image. Use another datasource. */}

  For example, without phrase detection a search for the words `background check` would show results for both `background` and `check`. With phrase detection, this search would correctly boost results for `"background check"`.

  1. From the list of query rewrite options, select **Phrase**. A form will appear:

       <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-phrase.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=7ba78829b991fb56a2a3b7ae2eb2e2b9" alt="Create phrase query rewrite" width="314" height="544" data-path="assets/images/experience-optimizer/eo-query-rewrite-phrase.png" />

     This form contains the following fields:

     |              |                                                                                                                                                                                                                                 |                    |
     | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
     | Parameter    | Description                                                                                                                                                                                                                     | Example Value      |
     | Surface Form | The phrase itself.                                                                                                                                                                                                              | `background check` |
     | Word Count   | Indicates how many words are included in the phrase.                                                                                                                                                                            | `2`                |
     | Confidence   | Confidence score from the phrase job. A confidence level of `1` represents 100% confidence. For rules created automatically via machine learning, the confidence level will reflect the output from the machine learning model. | `1`                |
     | Tags         | Optional metadata tags that can be used to identify and organize rewrites.                                                                                                                                                      | `enrollmentpacket` |
     | Phrase Count | Denotes how many times this phrase was found in the source. This value is automatically set via machine learning. It does not need to be set manually.                                                                          | `5`                |
     | Boost Factor | The factor to use to boost this phrase in matching queries.                                                                                                                                                                     | `2.0`              |
     | Slop Factor  | Phrase slop, or the distance between the terms of the query while still considering it a phrase match.                                                                                                                          | `10`               |
  2. Enter the number of words in the phrase in the **Word Count** field.
  3. Click the **Save** button.

  The search is re-run, with your search words identified as a phrase, and a Search box information panel drops down to show that the new query rewrite has fired:

  <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-phrase-results.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=fe33834a632e2c387964ad7b342e43f2" alt="Phrase rewrite results" style={{ width: "500px" }} width="936" height="280" data-path="assets/images/experience-optimizer/eo-query-rewrite-phrase-results.png" />

  ## Synonym

  You can specify synonyms for a specified search term so that alternative words with the same meaning are automatically used in the search query. When a customer enters a search term with a synonym match, the alternative words are used instead of, or in addition to, the original search term.

  For example, the search term `questionnaire` could have the synonyms `application` and `survey`.

  1. From the list of query rewrite options, select **Synonym**. A form will appear:

       <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-synonym.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=594c930d87650713949189409a35babe" alt="Create synonym query rewrite" width="311" height="543" data-path="assets/images/experience-optimizer/eo-query-rewrite-synonym.png" />

     This form contains the following fields:

     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                         |
     | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
     | Parameter        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Example Value           |
     | Surface Form     | The term that has synonyms.                                                                                                                                                                                                                                                                                                                                                                                                                                         | `questionnaire`         |
     | Direction        | With a **oneway** search, the original search term is replaced by the synonym. In the preceding example, `questionnaire` would be replaced by the alternative words `application` and `survey`. With a **symmetric** search, the search query is expanded to include the original term and the synonyms, resulting in a greater number of potential hits. In the preceding example, this time the query would include `questionnaire`, `application`, and `survey`. | `symmetric`             |
     | Synonym Mappings | Synonyms for the surface form.                                                                                                                                                                                                                                                                                                                                                                                                                                      | `application, `survey\` |
     | Confidence       | Confidence score from the phrase job. A confidence level of `1` represents 100% confidence. For rules created automatically via machine learning, the confidence level will reflect the output from the machine learning model.                                                                                                                                                                                                                                     | `1`                     |
     | Tags             | Optional metadata tags that can be used to identify and organize rewrites.                                                                                                                                                                                                                                                                                                                                                                                          | `enrollmentpacket`      |
     | Count            | How many times this term occurred in the signal data when it was discovered. This value is optional when a rewrite is being defined manually.                                                                                                                                                                                                                                                                                                                       | `5`                     |
  2. Choose whether the direction is **oneway** or **symmetric**.
  3. Enter one or more alternative words in the **Synonym Mappings** field.
  4. Click the **Save** button.

  The search is re-run using the synonyms, and a Search box information panel drops down to show that the new query rewrite has fired:

  <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-synonym-results.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=379a0da674369fc0f6008e86d342aa49" alt="Synonym rewrite results" style={{ width: "500px" }} width="911" height="284" data-path="assets/images/experience-optimizer/eo-query-rewrite-synonym-results.png" />

  ## Remove Words

  <Note>The Remove Words feature is available in Fusion 5.4 and later.</Note>

  You can create a Remove Words query rewrite to remove words from a query. This query rewrite is helpful when a word in the search query does not add value to the search results.

  For example, you can rewrite a search query for `case study examples` to remove `examples` and then display results for `case study`.

  1. From the list of query rewrite options, select Remove Words. A form appears:

       <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-removewords.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=ef7372074979fd514b2f04fb81f92986" alt="Create remove words query rewrite" width="311" height="304" data-path="assets/images/experience-optimizer/eo-query-rewrite-removewords.png" />

  2. This form contains the following fields:

  | Parameter        | Description                                                                                                                                                                                                       | Example Value         |
  | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
  | Phrase to remove | The words to remove from the trigger phrase.                                                                                                                                                                      | `examples`            |
  | Trigger phrases  | The query that prompts the removal of the phrase. The trigger phrase is not necessarily a complete query. If the query contains the trigger phrase, then Fusion removes the phrase in the Phrase to Remove field. | `case study examples` |

  1. Enter a phrase to remove and a trigger phrase. Note that the phrase to remove is auto-populated with the query.
  2. Click **Save**.

  The search is re-run, and a Search box information panel drops down to show that the new query rewrite has fired:

  <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-query-rewrite-removewords-results.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=152441cc6c721ba099bca45449c5062c" alt="Remove words rewrite results" style={{ width: "500px" }} width="924" height="274" data-path="assets/images/experience-optimizer/eo-query-rewrite-removewords-results.png" />
</Accordion>

<Card title="Experience Optimizer: Rewrites Manager" class="note-image" href="https://academy.lucidworks.com/experience-optimizer-rewrites-manager" cta="Take this course on the LucidAcademy." icon="graduation-cap" iconType="duotone">
  The course for **Experience Optimizer: Rewrites Manager** focuses on how to create search rewrites that optimize your user’s search results.
</Card>

## Optimize zero results

Search queries that return zero results can drive customers away from your site. You can set certain documents to display when a customer search generates zero results.

<Accordion title="Optimizing Zero Results">
  1. Enter a search query the generates 0 results:
       <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-resolve-zero-results-1.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=ebefd0e06ec341f31e54b0953d1a263d" alt="Optimizing Zero Results 01" width="1989" height="704" data-path="assets/images/experience-optimizer/eo-resolve-zero-results-1.png" />
  2. Click the **Add** button:  <img className="inline-image" alt="Add" src="https://mintcdn.com/lucidworks/xQr7Fxxc7lI5hKz-/assets/images/predictive-merchandiser/buttons/pm-facet-add-additional.png?fit=max&auto=format&n=xQr7Fxxc7lI5hKz-&q=85&s=0c90c652d92b93b5f21b2948385e293b" width="80" height="33" data-path="assets/images/predictive-merchandiser/buttons/pm-facet-add-additional.png" />
  3. Select documents or [document groups](/docs/5/fusion/getting-data-out/curating-your-search-experience/experience-optimizer/eo-document-grouping) that you want to associate with the 0 results query:
       <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-resolve-zero-results-2.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=43754229a3d1414297fda8057d6f555e" alt="Optimizing Zero Results 02" width="2124" height="858" data-path="assets/images/experience-optimizer/eo-resolve-zero-results-2.png" />
  4. Click the **Insert** button. The selected products are now displayed when the search query is used, resolving the 0 results query:
       <img src="https://mintcdn.com/lucidworks/aJg00sncwy9AQv3p/assets/images/experience-optimizer/eo-resolve-zero-results-3.png?fit=max&auto=format&n=aJg00sncwy9AQv3p&q=85&s=f0207c933ac010b8ea688dfd6d426ce5" alt="Optimizing Zero Results 03" width="2008" height="617" data-path="assets/images/experience-optimizer/eo-resolve-zero-results-3.png" />
</Accordion>

## Rule conflict resolution

Sometimes, rules created in the [Rules Editor](/docs/lucidworks-search/07-improve-your-queries/rules-editor/overview) and Experience Optimizer conflict with each other. For example, if you have three rules to boost, bury, and block a document, Experience Optimizer highlights these conflicting rules so you can address them.

To highlight conflicting rules, the **Rules Fired** section displays a red warning icon next to the dominant rule and a red flag on the conflicting rules.

Click the **Edit** button to view the details of the conflicting rules and resolve the conflict.

The details of the conflicting rules affecting specific documents are found in the Document Details panel. Click the **Start Task** button, and then click the **Document Details** button.
