4

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.

RonLugge
  • 5,086
  • 5
  • 33
  • 61
  • 1
    You can use dictionary DB or Table. But thing is that whether the word is actually miss spelled or is it that way only. Like company names etc.... – Sagar Kadam Mar 01 '13 at 06:15
  • It is quite impossible task to do but if the key word is specific to any category, like mail as you mentioned, you can simply manage a data table for all the mail service provider list and search for perfect list before executing in mysql. – Sudip Pal Mar 01 '13 at 06:17
  • http://dev.mysql.com/doc/refman/5.1/en/regexp.html – open source guy Mar 01 '13 at 06:26

2 Answers2

4

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:

Community
  • 1
  • 1
Aaron Blenkush
  • 3,034
  • 2
  • 28
  • 54
3

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

Checkout the SOUNDEX Example.

Rikesh
  • 26,156
  • 14
  • 79
  • 87