implement PagedProvider for file search

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-03-11 17:10:24 +01:00
parent 424db15dea
commit b62ee577d7
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 10 additions and 1 deletions

View File

@ -30,12 +30,13 @@
namespace OC\Search\Provider; namespace OC\Search\Provider;
use OC\Files\Filesystem; use OC\Files\Filesystem;
use OCP\Search\PagedProvider;
/** /**
* Provide search results from the 'files' app * Provide search results from the 'files' app
* @deprecated 20.0.0 * @deprecated 20.0.0
*/ */
class File extends \OCP\Search\Provider { class File extends PagedProvider {
/** /**
* Search for files and folders matching the given query * Search for files and folders matching the given query
@ -88,4 +89,12 @@ class File extends \OCP\Search\Provider {
// return // return
return $results; return $results;
} }
public function searchPaged($query, $page, $size) {
if ($size === 0) {
return $this->search($query);
} else {
return $this->search($query, $size, ($page - 1) * $size);
}
}
} }