I am trying to apply ranking to the output of my search result based on the relevance of the searchterm & record in database.
when I run the below code..there was a query error

Code PHP:
$result = $db->query("SELECT subject, learningArea, ability, MATCH(subject, learningArea, ability) AGAINST('$searchterm') AS relevance FROM lesson IN BOOLEAN MODE)");

I have tried this as well

PHP Code:
 $result=$db->query("SELECT lessonID, subject, learningArea, ability FROM lesson WHERE MATCH (subject,learningArea,ability) 
stripslashes (str_replace (""""\"", ($_GET['searchterm']))) . "' IN BOOLEAN MODE) "); 
the output was ok but no relevance shown..where should I put relevance here.

Many thanks for your help.