3

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.

sleepless_in_seattle
  • 2,132
  • 4
  • 24
  • 35

2 Answers2

1

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.

sleepless_in_seattle
  • 2,132
  • 4
  • 24
  • 35
  • Try using a `%LIKE%` query instead (if you detect this special character). I don't see any other workaround. – SuN Mar 13 '17 at 11:19
0

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.

Olaf Dietsche
  • 72,253
  • 8
  • 102
  • 198
  • They seem to be exactly the same, both as MyISAM and utf8_swedish_ci. For some reason the local version says fulltext index cardinality = 1 and the production server says it's 0. Though it works exactly the same if used with normal search words. – sleepless_in_seattle Oct 29 '12 at 09:23