The "Did you mean" feature

Discussion in 'PHP' started by lucym, Mar 18, 2008.

  1. lucym

    lucym New Member

    Joined:
    Mar 18, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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
    data
    searching
    meta

    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.
     
  3. lucym

    lucym New Member

    Joined:
    Mar 18, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    i am now testing Levenstein, Soundex, and Yahoo API. I hope at least one will give me good results :)
     
  4. lucym

    lucym New Member

    Joined:
    Mar 18, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    OK, the winner is Yahoo Spelling Suggestion (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. This is a page that gives a suggestion, this 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
     
  5. cutpasghost

    cutpasghost New Member

    Joined:
    May 9, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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

    thanks
    Josh
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice