summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Node/Folder.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/Node/Folder.php')
-rw-r--r--lib/private/Files/Node/Folder.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index 1e9088a7c19..b0569a24aa1 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -383,6 +383,8 @@ class Folder extends Node implements \OCP\Files\Folder {
// Search in batches of 500 entries
$searchLimit = 500;
$results = [];
+ $searchResultCount = 0;
+ $count = 0;
do {
$searchResult = $this->recentSearch($searchLimit, $offset, $storageIds, $folderMimetype);
@@ -391,6 +393,8 @@ class Folder extends Node implements \OCP\Files\Folder {
break;
}
+ $searchResultCount += count($searchResult);
+
$parseResult = $this->recentParse($searchResult, $mountMap, $mimetypeLoader);
foreach ($parseResult as $result) {
@@ -398,7 +402,8 @@ class Folder extends Node implements \OCP\Files\Folder {
}
$offset += $searchLimit;
- } while (count($results) < $limit);
+ $count++;
+ } while (count($results) < $limit && ($searchResultCount < (3 * $limit) || $count < 5));
return array_slice($results, 0, $limit);
}