views:

161

answers:

1

I am trying to add a fulltext index against a table, but it does not seem to apply.

ADD FULLTEXT `genre` (
`genre`
)

The query executes, but the cardinality remains at just 1 (even though i ahve a few thousand records)

I tried ANALYZE, REPAIR and neither seemed to update the index. If I create a regular index the cardinality is updated immediately.

A select against the index returns ans empty set, even though i know of matches.

+1  A: 

Cardinality has little sense for FULLTEXT indexes, since one record can be referenced by multiple keys (one key per word).

A FULLTEXT index will always be used for the query if it's applicable at all:

SELECT  *
FROM    genre
WHERE   MATCH(genre) AGAINST ('mystring')

The index, though, will not index the words less than ft_min_word_len characters long (which is 4 by default), and hence the query will not match them.

Could you please post the query which you think should work but it doesn't?

Quassnoi
Bingo. My matching row only had 3 words. I just switched to using LIKE on a INDEX and the performance difference is negligible.Thank!
Eddie
`@Eddie`: you can also change `ft_min_word_len` in `MySQL` settings.
Quassnoi