Recherche « booléenne » avec MySQL Jeudi, août 28th, 2008
Confronté au problème j’ai remarqué dernièrement que les accent dans la recherche MATCH AGAINST ne fonctionnait pas ! En effet le mot clé « vêtement » ne donnait pas le même résultat que « vetement ».
Aprés quelques recherches j’ai trouvé le post suivant sur mysql.com (http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html) :
—————–
Keep in mind that although MATCH() AGAINST() is case-insensitive, it also is basically **accent-insensitive**. In other words, if you do not want _mangé_ to match with _mange_ (this example is in French), you have no choice but to use the BOOLEAN MODE with the double quote operator. This is the only way that MATCH() AGAINST() will make accent-sensitive matches.
E.g.:
SELECT * FROM quotes_table WHERE MATCH (quote) AGAINST (‘ »mangé »‘ IN BOOLEAN MODE)
For multiword searches:
SELECT * FROM quotes_table MATCH (quote) AGAINST (‘ »mangé » « pensé »‘ IN BOOLEAN MODE)
SELECT * FROM quotes_table MATCH (quote) AGAINST (‘+ »mangé » + »pensé »‘ IN BOOLEAN MODE)
Although the double quotes are intended to enable phrase searching, just like any web search engine for example, you can also use them to signify single words where accents and other diacritics matter.
The only drawback to this method seems to be that the asterisk operator is mutually exclusive with the double quote. Or I just haven’t been able to combine both effectively.
—————–
Problème à priori corrigé, je teste tout cela je donne mon retour