views:

116

answers:

2

I am trying to implement a search function on a database table using query expansion, and I'm aware that I have to add the FULLTEXT index on the fields I want to become searchable. I have tried to do this and got no errors from PHPMyAdmin, but when I examine the structure of the table the cardinality of the FULLTEXT index is 0. I have tried inidividually setting the FULLTEXT index and it seems to work, but my serach returns the error: Can't find FULLTEXT index matching the column list

Any ideas what's going wrong?

+1  A: 

Try executing a REPAIR on the table you have just added them to, to (re)build the fulltext indexes:

REPAIR table foo

Also note that fulltext will only work on varchar or text columns. As a last resort, I would try restarting MySql.

The following page just about covers everything:

http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html

Hope that helped.

karim79
That helped somewhat...instead of saying cardinality none, it now says 1. Does that refer to the number of records affected or the number of columns that now have that index? I tried re-indexing them and repairing again, but still just cardinality one, and my script still produces the same error message. So it partly worked, but not fully.
@chibineku - are you applying a fulltext to individual columns?
karim79
The first query I made assigned it to several - 7 I think. I have since used PHPMyAdmin to apply it to single columns in turn.
I have tried adding the index one at a time, and this works for the title field of my table, which is VARCHAR, but not for the others. I tried the query doing only one column at a time and only the title one seems to have worked. The rest are either VARCHAR or TEXT datatype, and after adding each one I repaired the table, so I don't see what could possibly go wrong.
A: 

I had to add the index on all fields i wanted to be searchable and in the combination I wanted to search them...