[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1296
  • Last Modified:

misspelled search query

I am using a mysql database.
when there is a search I usually make this query:
select * from user where user.name = '%@name%'

now my question is:
How to have a search query when there is a misspelled word?
0
kecoak
Asked:
kecoak
1 Solution
 
mmconsultantCommented:
I'm not sure I get what you're asking. Could you be a little more specific, maybe with an example or two?

Thanks.

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
if SOUNDEX() or full-text search don't give what you need:
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html

then, you need to develop something "new" yourself, adapted to what you actually need...
0
 
AlexanderRCommented:
What he wants is ability to search using a misspelled word, so if there is a record in a database "computer", it needs to be found using words "computer" and "compputer" alike.

Assuming that the data in database is spelled correctly you can have php do a spelling check on the form.  Some info
http://bs.php.net/manual/en/function.pspell-suggest.php.
So have that function get a word match from users misspellt word and put that match into your query.


May be this too.
http://www.zend.com/zend/spotlight/spellchecking.php
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now