I have problem with full text search just on UTF8/Unicode Persian/Arabic Language (nothing found from querys).
- Tables are set with utf8/utf8_persian_ci on encoding.
- Using
mysql_query("SET NAMES 'UTF8'");
for Unicode Querys. - English strings work fine.
Below is My search codes:
<?php
mysql_connect("localhost", "user", "password");
mysql_select_db("search");
mysql_query("SET NAMES 'UTF8'");
$q = $_GET['q'];
?>
<form action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="text" name="q" value="<?php echo $q; ?>">
<input type="submit" value="Search!">
</form>
<hr>
<?php
if (isset($q))
{
$res = mysql_query("SELECT *, MATCH(name, description) AGAINST ('$q') AS score from search_test WHERE MATCH (name, description) AGAINST('$q') order by score desc");
$ant = mysql_num_rows($res);
if ($ant > 0)
{ // query provided results – display results
echo ("<br/><h2>Search results for \"$q\":</h2>");
while ($result = mysql_fetch_array($res))
{
echo ("<h3>{$result['name']} ({$result['score']})</h3>{$result['description']}<br/><br/>");
}
}
else
{ // query provided 0 results – display 0 hit message
echo ("<br/><h2>Nothing Found \"$q\" query</h2>");
}
}
?>
where is the problem or how can I search with full-text on Unicode language ?