Jump to content

search function with hint


xbl1

Recommended Posts

Hi;I'd like to ask you that how i can create a search function with hint when the user misspelling some word.For example:i type a string like the "ful text serch mysql" in google, and it will ask me"Did you mean: full text search mysql?"what king of knowledge can help me to do that? Thanks

Link to comment
Share on other sites

i believe it deals with levenshtein(sp?) calculations. http://us3.php.net/manual/en/function.levenshtein.php is the place to look at. I'm guess you'll need a word DB and etc etc.. If anyone else knows a different way to do so then go for it, but i believe this is how google does it.

Link to comment
Share on other sites

I used to know that as "Edit distance"... but I suppose Levenshtein sounds more complex :)Edit: I found an XML dictionary which you can reference when performing spell-checks: http://www.ibiblio.org/webster/

Link to comment
Share on other sites

i believe it deals with levenshtein(sp?) calculations. http://us3.php.net/manual/en/function.levenshtein.php is the place to look at. I'm guess you'll need a word DB and etc etc.. If anyone else knows a different way to do so then go for it, but i believe this is how google does it.
Thanks a lot, but this method has a disadvantage that i need to store all the words into the array first. I think it may be has a defined function which has stored most of the words for us, like a dictionary.
Link to comment
Share on other sites

thats why you would use a database to hold and index words that are searched. you would then use php and mysql to put those values into the array and calculate levenshtein's

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...