PDA

View Full Version : MySQL Full Text Search from list



Chris
04-15-2008, 08:49 AM
I want to do the equivalent of a

SELECT *
FROM tablename
WHERE
fieldname IN ('US','UK','GB','CN');

Type query, except on a fulltext indexed text/blob field.

In my case there are over 250 words/phrases I am checking against, and I need the query to return all records that match any one of those phrases. The table has about half a million records.

What is the best way? Surely not 250 OR statements in my where clause?

If I can't think of an efficient way (though, this is a one time only query) I think what I'd do is run 250 queries, one for each word, marking articles in which the word/phrase appears. That way I'll have a simple parameter to check against. Still, 250 queries on a fulltext table of half a million records, sucks, I'm sure.