Hi
I am trying to perform a search on a text field and then order according to relevency.
For example I want records containing this text
%canon eos 5%
to be ranked higher than records containing
%canon% and %eos% and %5%
I cannot use FULLTEXT indexing because some of the search terms are too short, as you can see from the example.
This query extracts the correct number of records and the correct data but won't sort the records according to the relevency criteria stated above
//content is the text field
$query = "SELECT DISTINCT
suppliers.supplier_id,
suppliers.name,
suppliers.town,
suppliers.postcode,
suppliers.phone
FROM suppliers
LEFT JOIN links
ON links.supplier_id=suppliers.supplier_id
WHERE
links.content LIKE '%canon eos 5%'
OR ( links.content LIKE '%canon%'
AND links.content LIKE '%eos%'
AND links.content LIKE '%5%')";
How can I modify this query to display all of the %canon eos 5% matching records at the top of list?
As the results need to be paginated I have thought that traversing the recordset array assessing each element for relevency, re-ordering the array and then starting each page from a different pointer position would be too resource intensive.
Any thoughts would be very much appreciated
Thanks
Chris