From b6af62fd247567dc59c7671b50829392ba2f294b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 10 Mar 2021 18:46:18 +0100 Subject: limit constructing of result objects in file search even thought we currently have no proper way of limiting the search itself, we can at least limit the construction of the result objects. this saves about 40% of the time spend in the search request in my local testing Signed-off-by: Robin Appelman --- apps/files/lib/Search/FilesSearchProvider.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/files/lib/Search/FilesSearchProvider.php b/apps/files/lib/Search/FilesSearchProvider.php index 93600119357..1c4bc75ade7 100644 --- a/apps/files/lib/Search/FilesSearchProvider.php +++ b/apps/files/lib/Search/FilesSearchProvider.php @@ -103,7 +103,7 @@ class FilesSearchProvider implements IProvider { // Make sure we setup the users filesystem $this->rootFolder->getUserFolder($user->getUID()); - return SearchResult::complete( + return SearchResult::paginated( $this->l10n->t('Files'), array_map(function (FileResult $result) { // Generate thumbnail url @@ -121,7 +121,8 @@ class FilesSearchProvider implements IProvider { $searchResultEntry->addAttribute('fileId', (string)$result->id); $searchResultEntry->addAttribute('path', $result->path); return $searchResultEntry; - }, $this->fileSearch->search($query->getTerm())) + }, $this->fileSearch->search($query->getTerm(), $query->getLimit(), (int)$query->getCursor())), + $query->getCursor() + $query->getLimit() ); } -- cgit v1.2.3