List:General Discussion« Previous MessageNext Message »
From:Jim Sheffer Date:November 26 2013 11:20pm
Subject:fulltext question
View as plain text  
Hello all-

I have a question on searching via fulltext.

I have the following SQL statement:

	var('SQLResultsID') = 'select *, MATCH (product_id,product_name,product_desc) AGAINST("'
+ $sqlKeywordSearch + '") AS SCORE from products WHERE MATCH
(product_id,product_name,product_desc) AGAINST("' + $sqlKeywordSearchB + '" IN BOOLEAN
MODE) AND active NOT LIKE "%no%" ORDER BY score DESC

First off, the variable $sqlKeywordSearch contains the search keywords separated by
spaces.  The second variable, $sqlKeywordSearchB, has keywords separated by spaces but
also adds a “+" sign to the beginning of each keyword to do the Boolean search and
match all the keywords in the search.

question #1 - Is this the best way to do a boolean search but also return a usable
“score”?  The search is doing what I expect it to do so no problem there.

Here’s my main question: I want to be able to “boost" the rankings(score) of
the results based on the fields.  Anything that matches on the product_id field I would
like to get a higher ranking, then the product_name field next, then the product_desc last
(obviously, if something matches in the product_id field it is of greater importance than
if it matches in the product_description field).  I know I can boost, or "adjust", the
score to the keywords if I want but is there a way to add to the search score rankings
based on the field searched?

as always, Thank everyone for any help!


James Sheffer          jim@stripped
Lasso Developer
phone:  469-256-0268

fulltext questionJim Sheffer26 Nov