[Solved] Select Match Against with accent insensitive

Codes here !

Moderators: egami, macek, gesf

Post Reply
User avatar
gandahar
New php-forum User
New php-forum User
Posts: 112
Joined: Tue Mar 15, 2011 4:05 am

Thu Jan 26, 2012 5:39 am

Hi all ! :D

I have this query :

Code: Select all

$res = mysql_query('SELECT id_plato,plato_ES,plato_FR,plato_EN, MATCH(plato_ES, plato_FR, plato_EN) AGAINST ("'.$q.'") AS score FROM a_platos WHERE id_plato IN '.$bout_de_requete.' and MATCH (plato_ES, plato_FR, plato_EN) AGAINST("'.$q.'") ORDER BY score DESC');
$q = one or various word to search
$bout_de_requete = a list of ID to look in


my question :

is it possible to search with accent INSENSITIVE ?

the database (mysql 5.1.50) keep data in 3 languages (spanish, french and english)

the database is utf8_general_ci, all the tables the same, my php script work with utf8 too...

wich is the best approach to keep the query MATCH AGAINST (not boolean) and get result with accent INSENSITIVE ?

if not possible, wich solution we have ? (I really need the score to sort the results)

thanks guy !! :)
Last edited by gandahar on Thu Jan 26, 2012 7:04 am, edited 2 times in total.

User avatar
gandahar
New php-forum User
New php-forum User
Posts: 112
Joined: Tue Mar 15, 2011 4:05 am

Thu Jan 26, 2012 6:58 am

ok, it's working now !!!
I changed all the database this morning and I didn't make a new test after, but its working now

this query is by default ACCENT INSENSITIVE

but look at the query below, I changed the quotes, and it work now :D


if it can help :

Code: Select all

$res = mysql_query("SELECT id_plato,plato_ES,plato_FR,plato_EN, MATCH(plato_ES, plato_FR, plato_EN) AGAINST ('$q') AS score FROM a_platos WHERE id_plato IN $bout_de_requete and MATCH (plato_ES, plato_FR, plato_EN) AGAINST('$q') ORDER BY score DESC");
and the full query filled by variables :

Code: Select all

$res = mysql_query("SELECT id_plato,plato_ES,plato_FR,plato_EN, MATCH(plato_ES, plato_FR, plato_EN) AGAINST ('cÊpés') AS score FROM a_platos WHERE id_plato IN ('10','57','110','980','1023','2785','7954') and MATCH (plato_ES, plato_FR, plato_EN) AGAINST('cÊpés') ORDER BY score DESC");
thanks

Post Reply