mysqlescapingmatchslashagainst

MySQL match against with a slash


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.


Solution

  • 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.