I’m having some problems searching for products that contain a slash (for example ac/dc) with mysql’s match against.
There seems to be a certain setting that’s affecting this. On my windows’ xammp with default settings each of these works great:
MATCH (content) AGAINST ('+ac/dc*' IN BOOLEAN MODE)
and
MATCH (content) AGAINST ("+ac/dc*" IN BOOLEAN MODE)
and
MATCH (content) AGAINST ('"+ac/dc*"' IN BOOLEAN MODE)
and
MATCH (content) AGAINST ("'+ac/dc*'" IN BOOLEAN MODE)
and
MATCH (content) AGAINST ('+ac/dc*' IN BOOLEAN MODE)
But none of them work on our production server which is on a linux system (I don’t know which distro but it’s under plesk).
And what I mean by “don’t work”. The query returns 0 rows. The production server has ft_min_word as 2.
2
Answers
This was a server problem, to this day I still don't know how I could get it fixed, what I did was changed how the whole system works.
I have a search table where I store the search words, there I remove slashes so AC/DC becomes ACDC and on search I modify the query to remove the slash again so it tries to match ACDC and find's the correct row.
Look at the storage engine in both XAMP and production server. There are restrictions on fulltext search http://dev.mysql.com/doc/refman/5.1/en/fulltext-restrictions.html. Also, the table definitions must match for fulltext search.
Slash isn’t a special character, although double quotes is. So,
+ac/dc*
must give a different result set, than"+ac/dc*"
for example.Apart from that, the only difference, I can think of, would be different table contents.