Skip to content

Commit

Permalink
implement PagedProvider for file search
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Mar 11, 2021
1 parent 759e527 commit 03d8722
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/private/Search/Provider/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 03d8722

Please sign in to comment.