Search relevance
am 15.02.2011 22:55:16 von ron.piggott------=_NextPart_000_0133_01CBCD31.1EFF23C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I would like to have the search results display in order of relevance =
--- and essentially add these two lines to the query. =20
HAVING relevance > 0.2=20
ORDER BY relevance DESC
However with how I built the database and the search spanning several =
tables I am unsure how to do this. Could someone help me please?
Ron
SELECT `ministry_profiles`.`reference`, =
`ministry_profiles`.`organization`, =
`ministry_profiles_activity`.`activity`
FROM
(
(
( `ministry_profiles` LEFT OUTER JOIN =
`ministry_profiles_listing_details` ON=20
`ministry_profiles`.`reference` =
`ministry_profiles_listing_details`.`ministry_profile_refere nce` )
LEFT OUTER JOIN `ministry_profiles_activity` ON=20
`ministry_profiles`.`reference` =
`ministry_profiles_activity`.`ministry_profiles_reference` )
LEFT OUTER JOIN `ministry_profile_categories` ON=20
`ministry_profiles`.`reference` =
`ministry_profile_categories`.`ministry_profiles_reference` )
LEFT OUTER JOIN `ministry_categories` ON=20
`ministry_profile_categories`.`ministry_categories_reference ` =
`ministry_categories`.`reference`
WHERE
(
MATCH( `ministry_profiles`.`organization`,=20
`ministry_profiles`.`address_line_1`, =
`ministry_profiles`.`address_line_2`,=20
`ministry_profiles`.`city`, `ministry_profiles`.`province_state`,=20
`ministry_profiles`.`postal_zip_code`, `ministry_profiles`.`country`,=20
`ministry_profiles`.`telephone`, `ministry_profiles`.`toll_free`,=20
`ministry_profiles`.`fax`, `ministry_profiles`.`email`,=20
`ministry_profiles`.`website` )
AGAINST
('$search')
AND
`ministry_profiles`.`live` =3D1
)
OR
(
MATCH( `ministry_categories`.`category` )
AGAINST
('$search')
)
OR
(
MATCH( `ministry_profiles_activity`.`activity` )
AGAINST
('$search')
AND `ministry_profiles_activity`.`live` =3D1
)
OR
(
MATCH( `ministry_profiles_listing_details`.`contact`,=20
`ministry_profiles_listing_details`.`year_founded`,=20
`ministry_profiles_listing_details`.`volunteer_opportunities `,=20
`ministry_profiles_listing_details`.`employment_opportunitie s`,=20
`ministry_profiles_listing_details`.`members_of`,=20
`ministry_profiles_listing_details`.`major_events`,=20
`ministry_profiles_listing_details`.`associate_member_of`,=2 0
`ministry_profiles_listing_details`.`registration_number`,=2 0
`ministry_profiles_listing_details`.`fund_raising`,
`ministry_profiles_listing_details`.`accredited_by`,
`ministry_profiles_listing_details`.`facebook`,
`ministry_profiles_listing_details`.`twitter` )
AGAINST
('$search')
AND
`ministry_profiles_listing_details`.`live` =3D1
)
GROUP BY `ministry_profiles`.`reference`
------=_NextPart_000_0133_01CBCD31.1EFF23C0--