MySQL全文搜索和SOUNDEX [英] MySQL Full-text search and SOUNDEX

查看:157
本文介绍了MySQL全文搜索和SOUNDEX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用全文搜索和SOUNDEX来实现名和姓的搜索(如果名称拼写错误)。



我试图做一些像

  SELECT * 
FROM employees
WHERE
MATCH SOUNDEX(first_name,last_name )反对SOUNDEX('John 1969 Ivan')

但这不是有效的语法。



我想要实现的是,当用户键入例如Jon Ivan时,列

  first_name | last_name 
----------------------
John Ivan

会匹配。

预先感谢!

解决方案

当涉及到文本搜索,模糊搜索,拼写错误等问题时,MySQL往往不够用。我强烈建议使用索引解决方案,如 Solr 。 Solr支持四种不同类型的语音搜索:Soundex,RefinedSoundex,Metaphone和DoubleMetaphone。它具有地理空间搜索和拼写错误搜索以及蝴蝶/蝴蝶搜索。我想你会很满意你得到的结果。与MySQL相比,它的增长速度很快


I am trying to implement a first and last name search using full-text search and SOUNDEX (in case if the name is misspelled).

I was trying to do something like

SELECT * 
    FROM employees 
WHERE 
    MATCH SOUNDEX(first_name, last_name) AGAINST SOUNDEX('John 1969 Ivan')

but this is not a valid syntax.

What I want to achieve, is that when a user types for example "Jon Ivan", the columns

first_name | last_name
----------------------
  John        Ivan

would match.

Thank you in advance!

解决方案

MySQL tends to fall short when it comes to text searches, fuzzy searches, misspellings, etc. I highly recommend an indexing solution like Solr. Solr supports four different types of phonetic searches: Soundex, RefinedSoundex, Metaphone, and DoubleMetaphone. It has geospatial searching and misspelling searches along with butterfly/butterflies searching. I think you will REALLY be happy with the results you get. It is lightening fast compared to MySQL

这篇关于MySQL全文搜索和SOUNDEX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆