summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-02-07 09:35:55 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-02-07 13:41:15 +0100
commitc1ff12e2340a6a1ea2a9032848778af7085ff150 (patch)
tree55f985d096d3c00be04da5ad7bfe9f242a2d21dd /lib/private
parent6b5419ddf09aaa8fcbd2e9e31ec8e445d7da19b6 (diff)
downloadnextcloud-server-c1ff12e2340a6a1ea2a9032848778af7085ff150.tar.gz
nextcloud-server-c1ff12e2340a6a1ea2a9032848778af7085ff150.zip
CacheJail should apply limit and offset after searching
Else the results might not be correct. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheJail.php11
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;
}
/**