The "Did you mean" feature

lucym's Avatar, Join Date: Mar 2008
Newbie Member
Hello, I want to add the 'did you mean' feature (like on Google) on my shareware site, where a lot of users have mistypes, and they get 0 results... so they exit the site very fast. Do you have any idea how I could implement such a thing? Does it require a dictionary or something? I found some scripts, but none of them gave relevant results... just stupid, irrelevant suggestions. Any help would be appreciated...
Thanks, Lucy
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You need a meta data about the data you are searching and then have a sound matching algorithm to find the words that resembles.

As an example I am searching where the following text is in the database :
"You need a meta data about the data you are searching."

Now the meta data would be the following
meta data

Now you also have the suggestions based on your meta

say a user types
serching then you don't have the stuff in the meta data and so you suggest him the nearest match like searching.

The meta data that I am talking about can be a dictionary as well.
lucym's Avatar, Join Date: Mar 2008
Newbie Member
i am now testing Levenstein, Soundex, and Yahoo API. I hope at least one will give me good results
lucym's Avatar, Join Date: Mar 2008
Newbie Member
OK, the winner is Yahoo Spelling Suggestion (which uses Yahoo API). This gives your site the possibility to suggest exactly what Yahoo Search suggests Awesome, I would say!

Here is a short summary about using it, if you guys want to use it too: it requires a Yahoo API key, which can be got free. It is limited to 5000 queries per day, so I suggest caching the suggestion (which I implemented, as my site has more then 5000 searches per day). The page returned by Yahoo needs to be parsed, and see if there is a suggestion given. This is a page that gives a suggestion, this is one that has no suggestion.

You can see it live on my shareware site: try some mistypes, like "enail backup", "rgistry cleaner" or whatever you want. I also implemented a function to make bold italic the words that are different between the search query and the suggestion from Yahoo.

If you need assistance on implementing this on your site, let me know.

Thanks, Lucy
cutpasghost's Avatar, Join Date: May 2008
Newbie Member
might be a silly question....but how would you go about caching the suggestions?

you can also email me.
couto.josh at gmail dot com