summaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-03-10 18:46:18 +0100
committerRobin Appelman <robin@icewind.nl>2021-03-11 14:49:57 +0100
commit424db15deaef20856e29ba1c886f06864a393eea (patch)
tree26b9df80afe012ea2e8ecde06302b2346f73a78c /apps/files/lib
parent95cddb84e2d07f105d7120a4f7b37c65419c0943 (diff)
downloadnextcloud-server-424db15deaef20856e29ba1c886f06864a393eea.tar.gz
nextcloud-server-424db15deaef20856e29ba1c886f06864a393eea.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/files/lib')
-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()
);
}