Forum Moderators: open

Message Too Old, No Replies

Closest match in MySQL

kind of like "Did you mean..."

         

wesg

10:36 pm on May 8, 2008 (gmt 0)

10+ Year Member



My Wordpress plugin uses a single db query for each element, and I want to build in a system that can detect the appropriate result even if the items do not match entirely.

Say for example that the result I need is Mr. Jobs.
The text that I input is Mr Jobs or Mr. Jobbs. How might I run my query so either of those two match up to the correct query?

rocknbil

4:08 pm on May 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try the soundex() [dev.mysql.com] function (sounds like, v. 4.1).

If that doesn't work for you, you might be in for a more complex solution, like maintaining a dictionary and doing some sort of scoring comparison (guessing.)