简体   繁体   中英

How can I write an MySQL search that can compensate for misspelled data?

Is there any way to write an MySQL search that can compensate for user-errors in spelling and the like?

As random examples, someone might type foo@gmial.com instead of foo@gmail.com.

Even help with search terms to help pull up relevant data from Google will be helpful. I'm not looking for a search engine, per say, what I'm looking for is some kind of spelling aid for an administrative control panel.

The topic you're delving into is called "Fuzzy Lookup". It's a big rabbit hole to jump down, depending on how precise you'd like to get. There are various methods, such as:

  • soundex
  • Damerau-Levenshtein distance
  • Jaro-Winkler distance
  • metaphone
  • double-metaphone

Some references to check out:

There are many ways to do the same. One of I personally like is SOUNDS LIKE .

Checkout the SOUNDEX Example .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM