diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-08 11:11:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-08 11:11:39 +0300 |
commit | e5c08621afa6c6ed083a5a7a7e001bca91102f07 (patch) | |
tree | fe7b695aeea5d067cc80b78b54f88c3f5b0be5de /lib | |
parent | b9393830495d4207d49169b7f2b2cee416f0f80c (diff) | |
parent | e4129b0dc76ce1dd7fd84c6297911174f0f92de7 (diff) |
Merge pull request #8023 from nextcloud/webdavsearch_limit_order_fixing
Respect limit and order in webdav search
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Cache/Wrapper/CacheJail.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 1ad00ba44c5..75df45e257b 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -29,6 +29,7 @@ namespace OC\Files\Cache\Wrapper; use OC\Files\Cache\Cache; +use OC\Files\Search\SearchQuery; use OCP\Files\Cache\ICacheEntry; use OCP\Files\Search\ISearchQuery; @@ -236,8 +237,14 @@ class CacheJail extends CacheWrapper { } public function searchQuery(ISearchQuery $query) { - $results = $this->getCache()->searchQuery($query); - return $this->formatSearchResults($results); + $simpleQuery = new SearchQuery($query->getSearchOperation(), 0, 0, $query->getOrder(), $query->getUser()); + $results = $this->getCache()->searchQuery($simpleQuery); + $results = $this->formatSearchResults($results); + + $limit = $query->getLimit() === 0 ? NULL : $query->getLimit(); + $results = array_slice($results, $query->getOffset(), $limit); + + return $results; } /** |