Skip to content

add typo tolerance to Meilisearch 101 #1683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -904,3 +904,10 @@ updating_guide_add_documents_old: |-
-X POST 'http://127.0.0.1:7700/indexes/{index_uid}/documents' \
-H 'Content-Type: application/json' -d @mydocuments.json \
-H 'X-Meili-API-Key: API_KEY'
getting_started_typo_tolerance: |-
curl \
-X POST 'http://localhost:7700/indexes/movies/settings/typo-tolerance' \
-H 'Content-Type: application/json' \
--data-binary '{
"minWordSizeForTypos": { "oneTypo": 4 }
}'
1 change: 1 addition & 0 deletions .vuepress/public/sample-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,4 @@ updating_guide_get_settings_old: |-
updating_guide_retrieve_documents_old: |-
updating_guide_update_settings_old: |-
updating_guide_add_documents_old: |-
getting_started_typo_tolerance: |-
23 changes: 21 additions & 2 deletions learn/getting_started/customizing_relevancy.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ For example, if you search the `movies` index for `2012`, Meilisearch searches f

<CodeSamples id= "getting_started_update_searchable_attributes" />

Meilisearch will now only consider `title` during search and you will see fewer results.
Meilisearch will now only consider `title` during search, and you will see fewer results.

::: note

Expand Down Expand Up @@ -132,4 +132,23 @@ This will set `winnie` and `piglet` as synonyms; searching for either word will

You can read more about it in our [dedicated guide](/learn/configuration/synonyms.md).

The next chapter tackles more advanced topics including security and data backup.
## Typo tolerance

Meilisearch is typo tolerant by default. It will help you find relevant search results even if you make spelling mistakes or typos, e.g., searching for `swaj` instead of `swan`.

The `typoTolerance` object allows you to:

- Enable or disable the typo tolerance feature
- Configure the minimum word size for typos
- Disable typos on specific words
- Disable typos on specific attributes

Meilisearch accepts one typo for query terms containing `5` or more characters by default. If you search the movies index for `swaj`, you will not get any results.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be referring to 5 as 5? On a quick read I briefly thought that 5 was a search term.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used 5 here because the typo tolerance guide mostly uses backticks for number of characters

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to use backticks in the context of typo tolerance since we're speaking indirectly about the value of minWordSizeForTypos.


<CodeSamples id= "getting_started_typo_tolerance" />

The above code sample sets the minimum word size for one typo to `4` characters. If you search for `swaj` now, you should get some results.

You can read more about typo tolerance in our [dedicated guide](/learn/configuration/typo_tolerance.md).

The next chapter tackles more advanced topics, including security and data backup.