Meaningful Text Phrase Search on a MySQL Database

Soldato
Joined
24 Sep 2007
Posts
4,912
Hi Guys

I am looking for some general advice on how to do a meaningful text phrase search on a MySQL database. I have a database full of text descriptions for shopping products, and I want to build a search function against the database that is as useful as possible.

Let's say I have the search term "green mens jumper".

So far, I am splitting the search term up into each word and then running each word against the database, using a wildcard match in the SQL, i.e.

... WHERE ProductName LIKE %SearchWord1% ...

etc

This does produce some helpful results, but use of the wildcard means anything with the term womens in it would also be shown, i.e. it produces irrelevant results.

I have heard of something called full-text search, and producing indexes, is this something that should be done? I am trying to get some level of intelligent search, but this does not seem like an easy task!

Can anyone give me some general advice?

Thanks
 
Soldato
OP
Joined
24 Sep 2007
Posts
4,912
It's for practical purposes. I have a shopping website that has a list of all product page names in a MySQL database, and I want users to be able to search for a particular product. It is quite a general question, i.e. what is the most powerful way to do text search against a MySQL database. I know how to do the basic SQL queries, but these won't give me particularly good results, so how can I make it better? Full-text search is a concept I have seen, but I don't really know what it is. I am guessing it can create some sort of index from the database to enable better search results. I am just after pointers in the right direction. I have been looking for PHP/MySQL database search scripts but the ones I have found are very basic and therefore can't give good results.

Thanks
 
Back
Top Bottom