Link to home
Start Free TrialLog in
Avatar of billy_howard
billy_howard

asked on

PHP Search?

Good afternoon experts.

I have been programming in PHP for a couple of years now so I have a pretty basic understanding of the language and how it works. However I have come into a little road block.

Basically, I am dealing with a database that has over 3 million rows in it, there are 4 main columns in the database, they are POST_TITLE, POST_DATE, POST_CONTENT & POST_AUTHOR.

I need to be able to search quickly through this database for key words.

For example if a user wants to search through the post_title column of the database, and display results i.e. if they searched for Bon Jovi and I had 300 rows in that database with Bon Jovi in the title, then It would find them.

I know that I could use something like SELECT * FROM DB WHERE POST_TITLE LIKE '%Bon Jovi%' and be shown some results, but I never really thing the "Like" in MySQL was very acurate, and I have no doubt that that would be slow.

So do I need to create an index of key words in a seperate table for each post or something???

Basically.

How do I quickly and easily search through a database that size?
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

The easiest solution is to use fulltext indexing:

http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html
ASKER CERTIFIED SOLUTION
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of billy_howard
billy_howard

ASKER

Thanks