summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-03-10 18:46:18 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-03-12 12:38:37 +0000
commitb6af62fd247567dc59c7671b50829392ba2f294b (patch)
treee64938b2c2cde21df1da23d5af23cefeb2b3add8 /apps
parent7f0f9fcd9334fc0f37f14f098da98c4633222804 (diff)
downloadnextcloud-server-b6af62fd247567dc59c7671b50829392ba2f294b.tar.gz
nextcloud-server-b6af62fd247567dc59c7671b50829392ba2f294b.zip
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 <robin@icewind.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/Search/FilesSearchProvider.php5
1 files changed, 3 insertions, 2 deletions
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()
);
}