2

Following this answer, I have used the MySQL command

SET NAMES utf8;

hoping that all these 4 cases of MySQL FULLTEXT search would work :

  • If text = 'lápiz',

    1) SELECT id, text FROM mytable WHERE MATCH (text) AGAINST ('lapiz' IN NATURAL LANGUAGE MODE) should work

    2) SELECT id, text FROM mytable WHERE MATCH (text) AGAINST ('lápiz' IN NATURAL LANGUAGE MODE) should work

  • If text = 'lapiz',

    3) SELECT id, text FROM mytable WHERE MATCH (text) AGAINST ('lapiz' IN NATURAL LANGUAGE MODE) should work

    4) SELECT id, text FROM mytable WHERE MATCH (text) AGAINST ('lápiz' IN NATURAL LANGUAGE MODE) should work

Strangely, 1) and 2) don't work (No result found!), but 3) and 4) work (lapiz is found).

How to have a really diacritic insensitive MySQL Full-Text search?

How do the collations work with MySQL Full-Text search feature?

PS: this is not a duplicate of the previously linked question, nor of this question. The difference seems to be linked with the use of Full-Text search MATCH(...) AGAINST (...) instead of LIKE.

Community
  • 1
  • 1
Basj
  • 41,386
  • 99
  • 383
  • 673
  • What version of mysql are you using? – Ivan Cachicatari Nov 03 '14 at 01:46
  • @IvanCachicatari : I have `5.1.73-1.1+squeeze+build0+1-log`. The problem is solved since I deleted the whole DB, and started a new one with `SET NAMES utf8;` everywhere before each DB writing action... There is a last thing however : I would like then when searching for `lápiz`, the results are given by relevance, i.e. results with `lápiz` (same diacritics) should be given **before** results with diacritics omitted (such as `lapiz`), and before results with wrong diacritics (such as `lâpïz`). How to sort by relevance? – Basj Nov 03 '14 at 07:38

0 Answers0