Intelligent search function (MySQL+PHP)

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
SvanteH
Forum Commoner
Posts: 50
Joined: Wed Jul 08, 2009 12:25 am

Intelligent search function (MySQL+PHP)

Post by SvanteH »

Is there an proven solution for finding out words that are similar (related?) to the original search-term of a database?
Lets say I search for %deaht%; is there a way of getting the similar word (Death) to be listed? I don't think SOUNDEX will give reliable results specially since the search will be based on another language than English.

Svante
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Intelligent search function (MySQL+PHP)

Post by jackpf »

Hmm....I don't know about soundex - never used it myself.

However, you could do something similiar to google with the "Did you mean....." with the pspell library and functions.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Intelligent search function (MySQL+PHP)

Post by VladSun »

We had a related discussion here:
viewtopic.php?f=2&t=102560
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Intelligent search function (MySQL+PHP)

Post by superdezign »

Also, I suspect that Google saves all words that the users type and, if a word is misspelled often, it automatically uses the presumed correct spelling in the search. Google also determines what word you meant to type by context as well, which I assume is also by looking at common mistakes in searches and the corrections that the users give in a subsequent search.

Basically, Google is complex.

/rant
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Intelligent search function (MySQL+PHP)

Post by jackpf »

I said like google. To be google is impossible. Their coders are like....genii :o
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Intelligent search function (MySQL+PHP)

Post by superdezign »

jackpf wrote:genii
Ironically, it took me a second to realize what you said.

/stupidity
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Intelligent search function (MySQL+PHP)

Post by josh »

superdezign wrote:Also, I suspect that Google saves all words that the users type and, if a word is misspelled often, it automatically uses the presumed correct spelling in the search. Google also determines what word you meant to type by context as well, which I assume is also by looking at common mistakes in searches and the corrections that the users give in a subsequent search.

Basically, Google is complex.

/rant
Sounds like a Bayesian network
Post Reply