views:

539

answers:

1

I am using a MATCH condition to match against a int field and a varchar field. According to http://bugs.mysql.com/bug.php?id=22343 when mixing binary and non-binary column types the match becomes binary and thus case sensitive.

My question is how would I go about making the search non-case-sensitive? I have tried using MATCH (lower(a),b) AGAINST ('title') but this does not work.

Here is a schema that can be used as a test.

CREATE TABLE IF NOT EXISTS `foo` (
  `a` int(11) NOT NULL,
  `b` varchar(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `foo` (`a`, `b`) VALUES
(2345345, 'title and volume'),
(145344, 'Volume'),
(1234214, 'Title');

SELECT * FROM `foo` WHERE MATCH (a,b) AGAINST ('title' IN BOOLEAN MODE)
+2  A: 

I guess you'd have to do:

SELECT *
FROM `foo`
WHERE MATCH(`a`) AGAINST ('title' IN BOOLEAN MODE)
OR MATCH(`b`) AGAINST ('title' IN BOOLEAN MODE)
chaos
That throws a syntax error. Similar to when I tried to do LOWER(a)
Ryan
That's irritating. I guess you have to break up the `MATCH` then.
chaos
I read before that breaking up the match would work. In my test with the above it is still case sensitive which doesn't make sense.
Ryan
Bizarre. Sounds like another bug to me.
chaos