Re: Search function query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have found the concept I am looking for on the mySQL web site:

SELECT MATCH('Content') AGAINST ('keyword1 keyword2') as Relevance FROM
table WHERE MATCH ('Content') AGAINST('+keyword1 +keyword2' IN BOOLEAN
MODE) HAVING Relevance > 0.2 ORDER BY Relevance DESC

I don't know how to apply this to the 3 fields in the data I want to
search with the users search string ( product_name ,
product_description , keywords )  The search string in the form is
"search_string"

Could someone show me how to make this work with what I have described
please?

Ron

-----Original Message-----
From: Ron Piggott <ron.php@xxxxxxxxxxxxxxxxxx>
Reply-to: ron.php@xxxxxxxxxxxxxxxxxx
To: PHP DB <php-db@xxxxxxxxxxxxx>
Subject: Search function query
Date: Sun, 01 Nov 2009 08:38:13 -0500

I am writing a search function.  Is there a way to enhance this query so
it will display the best matches first down to the least matches?  As
well I don't know how to handle if the user types in more than 1 word to
search.

SELECT * FROM `store_product_profile` WHERE `product_name` LIKE '%
$search_string%' AND `product_description` LIKE '%$search_string%' AND
`keywords` LIKE '%$search_string%'

Ron

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux