How to detect a typo in a product search and suggest possible corrections?

后端 未结 3 1246
后悔当初
后悔当初 2021-02-02 03:34

Given a very large database of product names, how would you detect possible typos in user searches and suggest possible corrections (Kinda like the way Google presents them)?

3条回答
  •  逝去的感伤
    2021-02-02 03:54

    You could use a phonetic algorithm, such as Soundex to find matches that sound similar.

    PostgreSQL has a module named fuzzystrmatch, with the docs showing examples of using Soundex, Levenshtein, Metaphone, and Double Metaphone.

提交回复
热议问题