vinpkl — 2012-10-11T07:34:28-04:00 — #1
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)";
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.
squeal — 2012-10-14T11:39:53-04:00 — #2
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!