我有一个包含以下列的 MySQL 表:
City Country Continent
New York States Noth America
New York Germany Europe - considering there's one ;)
Paris France Europe
如果我想找到有错字的“New Yokr”,使用 MySQL 存储函数很容易:
$querylev = "select City, Country, Continent FROM table
WHERE LEVENSHTEIN(`City`,'New Yokr') < 3"
但是如果有两个纽约城市,用全文搜索你可以输入“纽约州”,你会得到你想要的结果。
所以问题是,我可以搜索“New Yokr Statse”并得到相同的结果吗?
是否有任何功能可以合并 levenshtein 和 fulltext 以形成一个多合一的解决方案,或者我应该在 MySQL 中创建一个连接 3 列的新列?
我知道还有其他解决方案,例如 lucene 或 Sphinx(还有 soundex、metaphone,但对此无效),但我认为对我来说可能很难实现它们。