> ## 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.

# Misspelling Detection

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/4/fusion-ai/concepts/query-rewriting/misspelling-detection

[mintlify link]: https://doc.lucidworks.com/docs/4/fusion-ai/concepts/query-rewriting/misspelling-detection

[old doc.lw link]: https://doc.lucidworks.com/fusion/5.9/488

The Misspelling Detection feature maps misspellings to their corrected spellings. When Fusion receives a query containing a known misspelling, it rewrites the query using the corrected spelling in order to return relevant results instead of an empty or irrelevant results set.

Spelling corrections are applied in the [Text Tagger stage](/docs/4/fusion-server/reference/pipeline-stages/query/text-tagger-query-stage) of the query pipeline.

The [Token and Phrase Spell Correction job](/docs/4/fusion-ai/reference/jobs/token-and-phrase-spell-correction) automatically creates spelling corrections based on your AI-generated data. When you navigate to **Relevance** > **Rules**, the application displays the **Query Rewriting** screen. Select **Misspelling Detection**. The application displays the **Misspelling Detection** screen.

You can:

* **Use Misspelling Detection** on the output from the job
* **Use Misspelling Detection** from the `_query_rewrite_staging` collection

<Accordion title="Use Misspelling Detection">
  <Card title="Query Analytics" class="note-image" href="https://academy.lucidworks.com/query-analytics" cta="Take this course on the LucidAcademy." icon="graduation-cap" iconType="duotone">
    The course for **Query Analytics** focuses on how Fusion provides query analytics to detect and improve underperforming queries.
  </Card>

  {/* // tag::review[] */}

  <LwTemplate />

  ## Reviewing auto-generated spelling corrections

  Spelling corrections that are automatically generated by the [Token and Phrase Spell Correction job](/docs/4/fusion-ai/reference/jobs/token-and-phrase-spell-correction) are assigned one of the following status values:

  * **Auto**

    There are three values for confidence level:

    | Value | Confidence        | Label   |
    | ----- | ----------------- | ------- |
    | 0     | low confidence    | Pending |
    | 0.5   | median confidence | Auto    |
    | 1     | high confidence   | Auto    |

    <Note>No action is required on these results, but you can edit them if you wish.</Note>

  * **Pending**

    The confidence level is ambiguous, and the result must be reviewed by a user before it can be deployed.  It will only be moved from the `_query_rewrite_staging` collection to the `_query_rewrite` collection when its status has changed to "Approved" *and* it has been published.

  1. Navigate to **Relevance** > **Rules**. The application displays the **Query Rewriting** screen.

  2. Select **Misspelling Detection**. The application displays the **Misspelling Detection** screen.

       <Tip>
         Notice the **Status** facet on the left.  Click **Pending** to view only the items that need review.
       </Tip>

  3. Click the <InlineImage src="/assets/images/4.2/icons/edit-rule.png" alt="Edit icon" /> icon next to the spelling correction.

  4. In the **Status** column, select either "Approved" or "Denied".

     Optionally, you can also edit the spelling correction itself.

     <Tip>   Although the Confidence field is also editable, changing its value makes no difference.</Tip>

  5. Click the **Close** icon next to the updated spelling correction:

       <img src="https://mintcdn.com/lucidworks/vupE2UCZdg04NdXx/assets/images/4.2/rules-misspelling-close.png?fit=max&auto=format&n=vupE2UCZdg04NdXx&q=85&s=303fd5ee521213901106dd99b0b16a7a" alt="Close a spelling correction" width="445" height="434" data-path="assets/images/4.2/rules-misspelling-close.png" />

  <Note>Approving a spelling correction does not automatically deploy it to the `_query_rewrite` collection.  When you have finished your review, you must click **Publish** to deploy your changes.</Note>

  {/* // end::review[] */}

  {/* // tag::add-new[] */}

  ## Adding new spelling corrections

  You can manually add spelling corrections in addition to any generated by the [Token and Phrase Spell Correction job](/docs/4/fusion-ai/reference/jobs/token-and-phrase-spell-correction).

  1. Navigate to **Relevance** > **Rules**. The application displays the **Query Rewriting** screen.
  2. Select **Misspelling Detection**. The application displays the **Misspelling Detection** screen.
  3. At the bottom of the rules list, click the <InlineImage src="/assets/images/4.2/icons/add-rule.png" alt="Add icon" /> icon.

     A new spelling correction appears at the top of the list:

       <img src="https://mintcdn.com/lucidworks/vupE2UCZdg04NdXx/assets/images/4.2/rules-misspelling-add.png?fit=max&auto=format&n=vupE2UCZdg04NdXx&q=85&s=689f66732c5b91b8e8cc3b1fd3a83dae" alt="Add a spelling correction" width="1280" height="660" data-path="assets/images/4.2/rules-misspelling-add.png" />
  4. Enter the misspelled word or phrase.
  5. Enter one or more spelling corrections.

     <Tip>   It is not necessary to set a confidence value.</Tip>
  6. Select the spelling correction’s status, depending on whether you want to deploy it the next time you publish your changes ("Approved") or save it for further review ("Pending").
  7. Click the check mark to save the new spelling correction:

       <img src="https://mintcdn.com/lucidworks/vupE2UCZdg04NdXx/assets/images/4.2/rules-misspelling-save.png?fit=max&auto=format&n=vupE2UCZdg04NdXx&q=85&s=06f6da703fafb78a5e1fa2d1719d7496" alt="Save a spelling correction" width="1281" height="364" data-path="assets/images/4.2/rules-misspelling-save.png" />

  {/* // end::add-new[] */}

  {/* // tag::publish[] */}

  ## Publishing your changes

  **How to publish updated spelling corrections**

  1. In the **Misspelling Detection** screen, click the **PUBLISH** button.

     Fusion prompts you to confirm that you want to publish your changes.
  2. Click **PUBLISH**.

  {/* // Currently this does not update the count of unpublished changes. */}

  <Tip>You can un-publish a query rewrite by changing its status to "denied", then clicking **PUBLISH**.</Tip>

  {/* // I am assuming this is the case. */}

  {/* // end::publish[] */}

  ## Tuning the misspelling detection job

  The default configuration for the [Token and Phrase Spell Correction job](/docs/4/fusion-ai/reference/jobs/token-and-phrase-spell-correction) is designed for high accuracy and works well with most signal datasets, depending on the volume and quality of the signals.  If you are seeing too few results, or too many inaccurate results, then you can try tuning the job to achieve better results.

  To modify job configurations, you must be a Fusion user with one of the following roles or permissions that include access to job configurations:

  * [admin](/docs/4/fusion-server/concepts/security/access-control/roles)
  * [developer](/docs/4/fusion-server/concepts/security/access-control/roles)
  * [permissions](/docs/4/fusion-server/concepts/security/access-control/permissions)
</Accordion>

When you manually add new spelling corrections, subsequent job runs use those documents as input for machine learning to improve the job’s output. Unlike job-generated documents, manually-added query rewriting documents are never overwritten by new job output.

<Tip>
  Misspelled terms are completely replaced by their corrected terms. To expand the query to include all alternative terms, see the [Synonym Detection](/docs/4/fusion-ai/concepts/query-rewriting/synonym-detection) feature and set your synonyms to be [bi-directional](/docs/4/fusion-ai/concepts/query-rewriting/synonym-detection).
</Tip>

<img src="https://mintcdn.com/lucidworks/vupE2UCZdg04NdXx/assets/images/4.2/rules-misspelling.png?fit=max&auto=format&n=vupE2UCZdg04NdXx&q=85&s=70c47bda671126fc0d9ad23ac664ca4d" alt="Misspelling Detection screen" width="2880" height="1536" data-path="assets/images/4.2/rules-misspelling.png" />
