suttercain Posted August 10, 2007 Share Posted August 10, 2007 For example, I type in Timm, but it should be Tim. Can I still get it to echo the results? I don't think the LIKE clause would work here. But I am open for advice. Thanks. Link to comment https://forums.phpfreaks.com/topic/64184-is-it-possible-to-do-a-mysql-search-even-if-the-word-is-misspelled/ Share on other sites More sharing options...
Fadion Posted August 10, 2007 Share Posted August 10, 2007 SELECT * FROM table WHERE name LIKE '%tim%' should return Timm, Timmmm, or TTTTim. Link to comment https://forums.phpfreaks.com/topic/64184-is-it-possible-to-do-a-mysql-search-even-if-the-word-is-misspelled/#findComment-319937 Share on other sites More sharing options...
trq Posted August 10, 2007 Share Posted August 10, 2007 You could probably come up with something using regex's though I should imagine it would get quite complex. Link to comment https://forums.phpfreaks.com/topic/64184-is-it-possible-to-do-a-mysql-search-even-if-the-word-is-misspelled/#findComment-319941 Share on other sites More sharing options...
tippy_102 Posted August 10, 2007 Share Posted August 10, 2007 If your typing is really bad but you usually get the first letter correct, Soundex may do the trick. http://ca.php.net/soundex Link to comment https://forums.phpfreaks.com/topic/64184-is-it-possible-to-do-a-mysql-search-even-if-the-word-is-misspelled/#findComment-319944 Share on other sites More sharing options...
trq Posted August 10, 2007 Share Posted August 10, 2007 Yeah... mysql has a soundex function as well but Ive not had much luck using it. Link to comment https://forums.phpfreaks.com/topic/64184-is-it-possible-to-do-a-mysql-search-even-if-the-word-is-misspelled/#findComment-319954 Share on other sites More sharing options...
schme16 Posted August 10, 2007 Share Posted August 10, 2007 I've noticed a few people have made mention of the Soundex php function... My personal dealings with it have been rather small as its accuracy is well....low..... it measures only the first two syllables. I have seen the Metaphone function do a much better job... But by the looks of you posts, you want an in house solution (as in an all MySQL solution) for this problem.... and to date, there really only is the like statement that has the same type of speed as normal parsing, you could couple it with the Soundex or Metaphone functions for a very decent result... Link to comment https://forums.phpfreaks.com/topic/64184-is-it-possible-to-do-a-mysql-search-even-if-the-word-is-misspelled/#findComment-320049 Share on other sites More sharing options...
cooldude832 Posted August 10, 2007 Share Posted August 10, 2007 better idea is not to try and match the flaw, but to repair the flaw. Create a dictionary/spell checker and then say did you mean this like google does. Lotta work, but might already be completed, or there could be text libraries out there to use. Link to comment https://forums.phpfreaks.com/topic/64184-is-it-possible-to-do-a-mysql-search-even-if-the-word-is-misspelled/#findComment-320061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.