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 <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Mar 11, 2021
1 parent 424db15 commit 84b2d02
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/private/Search/Provider/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
namespace OC\Search\Provider;

use OC\Files\Filesystem;
use OCP\Search\PagedProvider;

/**
* Provide search results from the 'files' app
* @deprecated 20.0.0
*/
class File extends \OCP\Search\Provider {
class File extends PagedProvider {

/**
* Search for files and folders matching the given query
Expand Down Expand Up @@ -88,4 +89,14 @@ 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 84b2d02

Please sign in to comment.