ORDER BY relevance DESC query

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

 



I am programming the search feature for a directory.  I am trying to make the query display the results in order of relevance (Greatest to least).  I thought I had to perform the query similar to a column being selected in order to sort the results by "relevance".  What changes do I need to make to my query for it to work correctly?

The mySQL query is giving me the error message:
#1241 - Operand should contain 1 column(s)

The FULLTEXT index contains:
organization
address_line_1
address_line_2
city
province_state
postal_zip_code
country
telephone
toll_free
fax
email
website

Presently the mySQL query is:

SELECT `reference`, `organization` , 

( SELECT `reference`, `organization` FROM `ministry_profiles` 
WHERE
MATCH( `ministry_profiles`.`organization`, 
`ministry_profiles`.`address_line_1`, `ministry_profiles`.`address_line_2`, 
`ministry_profiles`.`city`, `ministry_profiles`.`province_state`, 
`ministry_profiles`.`postal_zip_code`, `ministry_profiles`.`country`, 
`ministry_profiles`.`telephone`, `ministry_profiles`.`toll_free`, 
`ministry_profiles`.`fax`, `ministry_profiles`.`email`, 
`ministry_profiles`.`website` )
AGAINST
('$search') 
AND `live` = 1
) AS relevance 

FROM `ministry_profiles` 
WHERE 
MATCH( `ministry_profiles`.`organization`, 
`ministry_profiles`.`address_line_1`, `ministry_profiles`.`address_line_2`, 
`ministry_profiles`.`city`, `ministry_profiles`.`province_state`, 
`ministry_profiles`.`postal_zip_code`, `ministry_profiles`.`country`, 
`ministry_profiles`.`telephone`, `ministry_profiles`.`toll_free`, 
`ministry_profiles`.`fax`, `ministry_profiles`.`email`, 
`ministry_profiles`.`website` )
AGAINST
('$search')
AND `live` = 1
ORDER BY relevance DESC

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

  Powered by Linux