FT.SPELLCHECK
FT.SPELLCHECK index query [DISTANCE distance] [TERMS INCLUDE | EXCLUDE dictionary [terms [terms ...]]] [DIALECT dialect]
Perform spelling correction on a query, returning suggestions for misspelled terms
indexis index with the indexed terms.
queryis search query.
See Spellchecking for more details.
TERMSspecifies an inclusion (INCLUDE) or exclusion (EXCLUDE) of a custom dictionary named {dict}. Refer to FT.DICTADD, FT.DICTDEL and FT.DICTDUMP about managing custom dictionaries.
DISTANCEis maximum Levenshtein distance for spelling suggestions (default: 1, max: 4).
DIALECT {dialect_version}selects the dialect version under which to execute the query. If not specified, the query will execute under the default dialect version set during module initial loading or via FT.CONFIG SET command.
FT.SPELLCHECK returns an array reply, in which each element represents a misspelled term from the query. The misspelled terms are ordered by their order of appearance in the query. Each misspelled term, in turn, is a 3-element array consisting of the constant string TERM, the term itself and an array of suggestions for spelling corrections. Each element in the spelling corrections array consists of the score of the suggestion and the suggestion itself. The suggestions array, per misspelled term, is ordered in descending order by score. The score is calculated by dividing the number of documents in which the suggested term exists by the total number of documents in the index. Results can be normalized by dividing scores by the highest score.
127.0.0.1:6379> FT.SPELLCHECK idx held DISTANCE 2
1) 1) "TERM"
2) "held"
3) 1) 1) "0.66666666666666663"
2) "hello"
2) 1) "0.33333333333333331"
2) "help"FT.CONFIG SET | FT.DICTADD | FT.DICTDEL | FT.DICTDUMP
© 2006–2022 Salvatore Sanfilippo
Licensed under the Creative Commons Attribution-ShareAlike License 4.0.
https://redis.io/commands/ft.spellcheck/