Hi Guys,
I got a listing table and I use mysql full text to search more then million business listing. When I search I would like to do this
1) Display first highest paid customers
2) Then display exact match
3) Then display similar other listing
It kinda work. How can I make the first matching word first in option 3?
Let's say i search for the word computer. There is a paid customer called 'Computer Institute'. So, this list will come first then Exact Match ie 'Computer Shop' then Computer Fixing, Computer Sales, ABC Computer. Currently it shows Computer institute,Computer shop, ABC Computer,Computer Fixing, Computer Sales. You can see ABC computer comes first in the option 3.
$search = '';
$the_array = explode(' ', $what);
$i = 0;
$total=count($the_array);
$the_array=array_filter($the_array);
//$search="'";
foreach( $the_array AS $t ){
$search.= "*$t ";
}
$sql="SELECT *,
CASE WHEN list_name = '$what' THEN 1 ELSE 0 END AS score,
MATCH (
list_name , list_cat , list_keywords
)
AGAINST (
'$search'
IN BOOLEAN
MODE
) AS score2
FROM listing
WHERE MATCH (
list_name , list_cat , list_keywords
)
AGAINST (
'$search'
IN BOOLEAN
MODE
)
AND list_status =1 $cond
order by list_package, score DESC, score2 DESC";