Avoid ordering just by a timestamp

Try to also employ an id when possible.
Involves reworking some of the indices.
This commit is contained in:
Alexei Sorokin
2020-09-15 16:59:27 +03:00
parent 8079a476b6
commit 52d67b0f44
41 changed files with 633 additions and 656 deletions

View File

@@ -39,12 +39,6 @@ class SearchEngine
public function set_sort_mode($mode)
{
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(
@@ -63,8 +57,12 @@ class SearchEngine
return $this->target->orderBy(sprintf('%1$s.nickname ASC', $this->table));
}
break;
case 'reverse_chron':
return $this->target->orderBy('created, id');
break;
case 'chron':
default:
return $this->target->orderBy('created DESC');
return $this->target->orderBy('created DESC, id DESC');
break;
}
}