Commit 10b27bcf authored by Stefan Froemken's avatar Stefan Froemken Committed by Christian Kuhn
Browse files

[TASK] Use ORDER BY uid DESC in LiveSearch

Sorting query results by text columns may require
a filesort on harddisk which is slow. To boost up
the search results of LiveSearch we have added
an ORDER BY uid DESC to always show the newest
created records first. Column "uid" exists in
all TCA tables and as it is PRIMARY INDEX
sorting will happen in memory.

Resolves: #96365
Releases: main, 11.5
Change-Id: Icbf6e8c7717a495aaee995ff09cf2cd882173e65

Tested-by: core-ci's avatarcore-ci <>
Tested-by: Benni Mack's avatarBenni Mack <>
Tested-by: Christian Kuhn's avatarChristian Kuhn <>
Reviewed-by: Benni Mack's avatarBenni Mack <>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <>
parent b72d3fd5
......@@ -199,11 +199,7 @@ class LiveSearch
$orderBy = $GLOBALS['TCA'][$tableName]['ctrl']['sortby'] ?? $GLOBALS['TCA'][$tableName]['ctrl']['default_sortby'] ?? '';
foreach (QueryHelper::parseOrderBy((string)$orderBy) as $orderPair) {
[$fieldName, $order] = $orderPair;
$queryBuilder->addOrderBy($fieldName, $order);
$queryBuilder->addOrderBy('uid', 'DESC');
$getRecordArray = $this->getRecordArray($queryBuilder, $tableName);
Supports Markdown
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