MySQL Forums
Forum List  »  Full-Text Search

full text search for utf-8 text
Posted by: Ran Geva
Date: August 03, 2006 12:08PM

Hi,
Im going crazy over this. I cant seem to make a search using fulltext on a text in a foreign language (hebrew, arabic, russian etc..). Here is what I did:

1) create a table:

DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`Num` int(10) unsigned NOT NULL auto_increment,
`lang` text collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`Num`),
FULLTEXT KEY `Index_2` (`lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Num Column is the ID and Lang Culumn is where I store the text.

2) Create a simple PHP script that will add data to the table:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>test</title>
</head>

<body>
<?php
if(isset($_REQUEST['var']))
{
$db_connect_id = mysql_connect("localhost", "username", "password");
if($db_connect_id)
{
$db_connect_id = mysql_select_db("powwow");
if($db_connect_id)
{
$sql = "insert into test set lang = '" . $_REQUEST['var']. "'";
mysql_query($sql);
echo "Done";

}
}else
echo "Error connecting to the DB;";
}
?>
<form action="/test.php">
<input type="text" name="var">
<input type="Submit">
</form>

</body>
</html>


3) Enter some hebrew or russian to the table (you can use google to find lots of text)

4) Make a search:

SELECT * FROM test WHERE MATCH (lang) AGAINST ('hebrew letters here' IN BOOLEAN MODE)

5) Got nothing back! It works with English though...


Any thoughts?

Options: ReplyQuote


Subject
Views
Written By
Posted
full text search for utf-8 text
6718
August 03, 2006 12:08PM
3336
September 21, 2006 02:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.