Exemplo n.º 1
0
 protected function getSortTokens(PlFilter $uf)
 {
     $toks = $uf->getNameTokens();
     $scores = array();
     // If there weren't any sort tokens, we shouldn't sort by score, sort by NULL instead
     if (count($toks) == 0) {
         return 'NULL';
     }
     foreach ($toks as $sub => $token) {
         $scores[] = XDB::format('SUM(' . $sub . '.score + IF (' . $sub . '.token = {?}, 5, 0) )', $token);
     }
     return implode(' + ', $scores);
 }