Well, it took me a while ... Since the key issue was getting the ranking for the total matches, the hard part of this query was a certain field:
MATCH (title, body) AGAINST ('$search') AS rating
I decided that I just had to write this field in the "field" option in the pagination array. The result is the following:
$this->paginate = array( 'limit' => 15, 'fields' => array('*', "MATCH (data) AGAINST ('$q') AS rating"), 'conditions' => "MATCH(SearchIndex.data) AGAINST('$q' IN BOOLEAN MODE)", 'order' => array( 'rating' => 'desc', ), ); $paginatedResults = $this->paginate('SearchIndex');
And it worked without a problem!
I think this is the best way to achieve real search results with Cake. If someone has no better alternative :)
Search phrases between double quotes will give you the results you should expect!
source share