MySQL - 寻找接近匹配 [英] MySQL - Finding Close Matches
问题描述
在 MySQL 中有没有办法在文本字段中找到接近的匹配项?在搜索 me1@email.com
时说 find me@email.com
?
Is there a way in MySQL to find close matches in a text field? Say find me@email.com
when searching for me1@email.com
?
所以基本上,如果用户正在搜索他们自己的电子邮件地址,并且它最初被错误地输入到数据库中,如果它稍微偏离,它就会抛出一个潜在的匹配
So basically if a user is searching for thier own email address, and it was originally entered into the database incorrectly, it throw up a potential match if it was slightly off
推荐答案
用模式匹配解决这类问题会让人头疼.
It would be a pain in the neck to solve this kind of problems with pattern matching.
两个字符串之间的 Levenshtein 距离是将一个字符串转换为另一个字符串所需的最少操作次数,其中操作可能是插入、删除或替换一个字符.
The Levenshtein distance between two strings is the minimum number of operations needed to transform one string into the other, where an operation may be insertion, deletion or substitution of one character.
检查这个.
这篇关于MySQL - 寻找接近匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!