From 03d8722b6b81e59cf5b7e299e6672f0a24a5ce64 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 11 Mar 2021 17:10:24 +0100 Subject: [PATCH] implement PagedProvider for file search Signed-off-by: Robin Appelman --- lib/private/Search/Provider/File.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/private/Search/Provider/File.php b/lib/private/Search/Provider/File.php index 8b72e0c318824..253a4013ec120 100644 --- a/lib/private/Search/Provider/File.php +++ b/lib/private/Search/Provider/File.php @@ -29,11 +29,12 @@ namespace OC\Search\Provider; use OC\Files\Filesystem; +use OCP\Search\PagedProvider; /** * Provide search results from the 'files' app */ -class File extends \OCP\Search\Provider { +class File extends PagedProvider { /** * Search for files and folders matching the given query @@ -85,4 +86,12 @@ public function search($query, int $limit = null, int $offset = null) { // return return $results; } + + public function searchPaged($query, $page, $size) { + if ($size === 0) { + return $this->search($query); + } else { + return $this->search($query, $size, ($page - 1) * $size); + } + } }