mirror of
https://github.com/nextcloud/server.git
synced 2026-04-08 18:46:28 -04:00
refactor(recent-search): use order by fields to determine extended cache join and cast config limit to number
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
This commit is contained in:
parent
9776782f4a
commit
7a21995bec
2 changed files with 8 additions and 2 deletions
|
|
@ -41,7 +41,7 @@ export async function getContents(path = '/', options: { signal: AbortSignal }):
|
|||
const contentsResponse = await client.search('/', {
|
||||
signal: options.signal,
|
||||
details: true,
|
||||
data: getRecentSearch(lastTwoWeeksTimestamp, store.userConfig.recent_files_limit + 1),
|
||||
data: getRecentSearch(lastTwoWeeksTimestamp, Number(store.userConfig.recent_files_limit)),
|
||||
}) as ResponseDataDetailed<SearchResult>
|
||||
|
||||
const contents = contentsResponse.data.results
|
||||
|
|
|
|||
|
|
@ -152,7 +152,13 @@ class QuerySearchHelper {
|
|||
|
||||
$requestedFields = $this->searchBuilder->extractRequestedFields($searchQuery->getSearchOperation());
|
||||
|
||||
$query = $builder->selectFileCache('file', true);
|
||||
$orderFields = array_map(fn ($order) => $order->getField(), $searchQuery->getOrder());
|
||||
|
||||
$joinExtendedCache = in_array('creation_time', $requestedFields)
|
||||
|| in_array('upload_time', $requestedFields)
|
||||
|| in_array('last_activity', $orderFields);
|
||||
|
||||
$query = $builder->selectFileCache('file', $joinExtendedCache);
|
||||
|
||||
if (in_array('systemtag', $requestedFields)) {
|
||||
$this->equipQueryForSystemTags($query, $this->requireUser($searchQuery));
|
||||
|
|
|
|||
Loading…
Reference in a new issue