We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 5f1a795b authored by Zach Copley's avatar Zach Copley

Add some other ways to order searches to the base search engine class

parent 7d76b55d
......@@ -41,8 +41,35 @@ class SearchEngine
function set_sort_mode($mode)
{
if ('chron' === $mode)
return $this->target->orderBy('created desc');
switch ($mode) {
case 'chron':
return $this->target->orderBy('created DESC');
break;
case 'reverse_chron':
return $this->target->orderBy('created ASC');
break;
case 'nickname_desc':
if ($this->table != 'profile') {
throw new Exception(
'nickname_desc sort mode can only be use when searching profile.'
);
} else {
return $this->target->orderBy('nickname DESC');
}
break;
case 'nickname_asc':
if ($this->table != 'profile') {
throw new Exception(
'nickname_desc sort mode can only be use when searching profile.'
);
} else {
return $this->target->orderBy('nickname ASC');
}
break;
default:
return $this->target->orderBy('created DESC');
break;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment