Tutorial for creating a 'search engine' with multiple words

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
defroster
Forum Commoner
Posts: 49
Joined: Wed Mar 24, 2010 12:05 pm

Tutorial for creating a 'search engine' with multiple words

Post by defroster »

Hello,

Does anyone know a tutorial I can follow to create my own search engine over the items I have in my SQL database?
I find a lot of tutorials but they are all 'one word searches' which means if you type two words you will get all results that contain either word (too many hits).

If the search engine tutorial displays result with AJAX even better.

Thanks for help.
df
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Tutorial for creating a 'search engine' with multiple wo

Post by John Cartwright »

To make similiary comparison of a string, you could use Fulltext Matches.

Otherwise, if you simply want to match any of the words against a database, then you would split the words by space, and add or

OR searchable_field LIKE '%$search world%'

which is basically a wildcard search (terribly innefficent and does not make use of indexes).

That is why Fulltext searching is recommended.
Post Reply