Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

Well, you should specify the type of database you are using. I will assume MySQL.
With MySQL there is a feature called full text searching that has several features - one of which is to find "close" matches and order them by relevance.
So you could do a search for 'computer' and get results such as:
- compass
- container
- colderI *think* you can adjust the level of relevance so that you do not get results that are wildly different from the search criteria.
Here is a link to a tutorial to get you started: http://www.onlamp.com/pub/a/onlamp/...
Michael J

Mysql I use.
If the user searchs for "conputer software", the suggestion of "compass software" or "container software" would be useless.will now look on that link from Laler, 10x.

"If the user searchs for "conputer software", the suggestion of "compass software" or "container software" would be useless."
Then, what exactly do you want? you did state that " a lot of users have mistypes, and they get 0 results". The sample results I posted above presume that those two other values exist in the database. I guess I should have given an example such as:
User enters "cmputer softwaer"
Results would be:
- "Computer Software"
- "Container Software"
- etc.Full Text Searching finds "relevant" matches and will return the results in order of their relevance.
Michael J

yep, that's what I ment: if a user searches for "dwnload software", to be suggested the search of "download software". not related suggestions, but correct suggestions for wrong words.

"not related suggestions, but correct suggestions for wrong words."
Well, a computer is not a mind-reader. It doesn't know the difference of whether the user misspelled a word or if their word doesn't exist in the database. Using Full Text Searching the system will return relevant results AND rate them with a score. It is up to YOU to decide what score constitutes a match that is worthy of showing.
A site like Google has invested many hundreds of man hours to refine their search capabilities to get the level of accuracy that they have. You should start small and refine your process as needed.
Michael J

OK, the winner is Yahoo Spelling Suggestion ( http://developer.yahoo.com/search/w... - which uses Yahoo API). This gives your site the possibility to suggest exactly what Yahoo Search suggests :cool: 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. http://search.yahooapis.com/WebSear... is a page that gives a suggestion, http://search.yahooapis.com/WebSear... is one that has no suggestion.
You can see it live on my shareware site: http://www.coredownload.com/ 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

![]() |
Create & upload my blog
|
Copyright on pictures
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |