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
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72669

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent b72d3fd5
......@@ -199,11 +199,7 @@ class LiveSearch
$queryBuilder->andWhere($this->userPermissions);
}
$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