Skip to content

Commit

Permalink
Update fuzzy.md (opensearch-project#7842)
Browse files Browse the repository at this point in the history
* Update fuzzy.md

Corrected the name of the string metric used by default

Signed-off-by: Tim <2527559+svitlo@users.noreply.github.com>
Signed-off-by: svitlo <tsplahtii@rolf.ru>

* correct the line 17 of fuzzy.md to clarify the distance name and the role of the field 'transpositions'

Signed-off-by: svitlo <tsplahtii@rolf.ru>

* correct the line 17 to not break the thought regarding the usage of the field 'max_expansions'

Signed-off-by: svitlo <tsplahtii@rolf.ru>

* Update _query-dsl/term/fuzzy.md

Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Signed-off-by: Tim <2527559+svitlo@users.noreply.github.com>
Signed-off-by: svitlo <tsplahtii@rolf.ru>

---------

Signed-off-by: Tim <2527559+svitlo@users.noreply.github.com>
Signed-off-by: svitlo <tsplahtii@rolf.ru>
Co-authored-by: svitlo <tsplahtii@rolf.ru>
Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
  • Loading branch information
3 people authored and mingshl committed Aug 2, 2024
1 parent d3fd3cd commit d85853e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _query-dsl/term/fuzzy.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ nav_order: 20

# Fuzzy query

A fuzzy query searches for documents containing terms that are similar to the search term within the maximum allowed [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance). The Levenshtein distance measures the number of one-character changes needed to change one term to another term. These changes include:
A fuzzy query searches for documents containing terms that are similar to the search term within the maximum allowed [Damerau–Levenshtein distance](https://en.wikipedia.org/wiki/Damerau–Levenshtein_distance). The Damerau–Levenshtein distance measures the number of one-character changes needed to change one term to another term. These changes include:

- Replacements: **c**at to **b**at
- Insertions: cat to cat**s**
- Deletions: **c**at to at
- Transpositions: **ca**t to **ac**t

A fuzzy query creates a list of all possible expansions of the search term that fall within the Levenshtein distance. You can specify the maximum number of such expansions in the `max_expansions` field. Then it searches for documents that match any of the expansions.
A fuzzy query creates a list of all possible expansions of the search term that fall within the Damerau-Levenshtein distance. You can specify the maximum number of such expansions in the `max_expansions` field. The query then searches for documents that match any of the expansions. If you set the `transpositions` parameter to `false`, then your search will use the classic [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance).

The following example query searches for the speaker `HALET` (misspelled `HAMLET`). The maximum edit distance is not specified, so the default `AUTO` edit distance is used:

Expand Down Expand Up @@ -90,4 +90,4 @@ Specifying a large value in `max_expansions` can lead to poor performance, espec
{: .warning}

If [`search.allow_expensive_queries`]({{site.url}}{{site.baseurl}}/query-dsl/index/#expensive-queries) is set to `false`, fuzzy queries are not run.
{: .important}
{: .important}

0 comments on commit d85853e

Please sign in to comment.