php - cakephp match against order by doesn't work -


i trying order pagination result. doesn't work.

$this->paginate = array(                 'limit' => 15,                 'fields' => array('*', "match (headline, author, short_headline, subline, teaser, text) against ('$var') score"),                 'conditions' =>  "match(headline, author, short_headline, subline, teaser, text) against('$var' in boolean mode)",                 'order' => array('score' => 'desc')             ); 

the query looks like:

select *, match (`headline`, `author`, `short_headline`, `subline`, `teaser`, `text`) against ('herz tod') `score`, `story`.`id` `fates`.`stories` `story` match(headline, author, short_headline, subline, teaser, text) against('herz tod' in boolean mode) limit 15 

and order score gone! doing wrong? help!

try making score virtualfield before try paginate in order use order pagination. (there may other ways order score, i'm not aware of them.)

$this->model->virtualfields['score'] = "match (headline, author, short_headline, subline, teaser, text) against ('" . sanitize::escape($var) . "')"; 

i'd point out, in case, code (and code posted above matter) vulnerable sql injection, if cannot assume $var trustworthy data, if $var comes user input.


Comments

Popular posts from this blog

visual studio - vb.net filter binding source by time -

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -