Fix error on quicksearching on promos
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Tue, 22 Jun 2010 22:01:52 +0000 (00:01 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Tue, 22 Jun 2010 22:01:52 +0000 (00:01 +0200)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/userfilter.php

index 20696a0..18bdadd 100644 (file)
@@ -1420,6 +1420,12 @@ class UFO_Score extends UserFilterOrder
     {
         $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);
         }