Fulltext search results

hi all

i m using this below code to search fulltext


$sql = "SELECT product_name FROM product_table WHERE MATCH (product_name) AGAINST ('+".$item_name."' IN BOOLEAN MODE)";
$result= mysql_query($sql);
		while($row=mysql_fetch_array($result))
		{
			echo $row['product_name']."\
";
			
		}


Product name is


New Nokia 5800 Red 

If i write “Nokia” in search box then this product name is shown.

If i write “5800” in search box then also this product name is shown.

But if i write 'Nokia 5800" in search box then this product name is not shown.

vineet

I can’t replicate your findings. However, " +‘Nokia 5800’ " means " find rows that contain the word ‘Nokia’, but rank rows higher if they also contain ‘5800’ "

To find an exact phrase, you’d need to wrap the phrase in qutoation marks - which might look like this…

$sql = "SELECT product_name,MATCH (product_name) AGAINST ('+\\"".$item_name."\\"' IN BOOLEAN MODE) score FROM product_table ";

Note that I’ve rewritten the query so you can see the actual score returned by each result!