3

I set up a MyISAM table to do FULLTEXT searching. I do not want searches to be case-sensitive.

My searches are along the lines of:

SELECT * FROM search WHERE MATCH (keywords) AGAINST ('+diversity +kitten' IN BOOLEAN MODE);

Let's say the keywords field I'm looking for has the value "my Diversity kitten".

I noticed the searches were case-sensitive. I double-checked my collation on the search table, it was set to utf8_bin. D'oh! I changed it to utf8_general_ci.

But my query is still case-sensitive! Why?

Is there a server setting I need to change, too?

Is there something I need to do besides change the collation?

I did a "REPAIR TABLE search QUICK" to rebuild the FULLTEXT index, but that didn't do it either...

My searches are still case-sensitive. =(

1
  • 1
    The table may be utf8_general_ci, but are the columns? Commented Feb 9, 2011 at 13:26

2 Answers 2

6

Aha, figured it out for reals this time.

I believe my issue was using NaviCat to update the collation. I have an older version of NaviCat, maybe it was a bug or something.

Doing:

ALTER TABLE search CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

fixed it correctly.

Always use command line, kids! =)

Sign up to request clarification or add additional context in comments.

Comments

1

Hmm - that behavior doesn't match the manual:

By default, the search is performed in case-insensitive fashion. However, you can perform a case-sensitive full-text search by using a binary collation for the indexed columns. For example, a column that uses the latin1 character set of can be assigned a collation of latin1_bin to make it case sensitive for full-text searches.

Which version of MySQL do you use? Can you provide some data that would allow replicating the problem on another machine?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.