Reputation: 177
We are moving to MariaDB 10.1 from MySQL 5.6 and have a Fulltext index for product descriptions and product numbers (InnoDB). A large number of our product numbers have a dash/hyphen in them like "Pf-2". If I search for that in MySQL it would search for "PF" and "2", both of which are under 3 characters and would return an empty result. Is it possible to have MariaDB treat the hyphen as a letter character instead of a stop/word break character? In MySQL the only way to do this with UTF8 character sets was to do a custom build of MySQL.
Upvotes: 1
Views: 1915
Reputation: 177
I ended up using:
`SELECT * FROM `Product` WHERE MATCH(`title`, `number`, `shortDescription`, `rawDescription`, `rawColors`)
AGAINST('PF-2' IN BOOLEAN MODE) OR `number` LIKE '%PF-2%'
Not ideal, but it got the job done until we get Sphinx running to replace the fulltext searches.
Upvotes: 0
Reputation: 400
You could quote the query string:
select *
from mytable
where match(mycol) against ('+"Pf-2"' in boolean mode)>0.0;
Upvotes: 3