Forum Moderators: open

Message Too Old, No Replies

MySQL full-text search

Can this be more efficient?

         

cschults

7:14 pm on Feb 24, 2009 (gmt 0)

10+ Year Member



I'm performing a boolean full-text in MySQL and searching three columns in two tables: tbl1.title, tbl1.desc, tbl2.comment. However, with tbl2.comment, I only want to search those records where tbl2.comment_code is either 'A' or 'B'.

Thus, I have this WHERE clause:

MATCH(tbl1.title, tbl1.desc) AGAINST('$search' IN BOOLEAN MODE) OR
(MATCH(tbl2.comment) AGAINST('$search' IN BOOLEAN MODE) AND (tbl2.comment_code = 'A' OR tbl2.comment_code = 'B'))

This works, but it can be slow, which I'm guessing is due to the two full-text searches.

Any suggestions on how to make this more efficient?

Thanks!

Demaestro

9:32 pm on Feb 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you have an index on the tbl2.comment_code?

That should help speed things up a bit

cschults

10:58 pm on Feb 24, 2009 (gmt 0)

10+ Year Member



Demaestro, thanks for the suggestion. I added an index to that column, but there is no change.