Merge pull request #27062 from nextcloud/search-limit-offset-jail

properly use limit and offset for search in Jail wrapper
This commit is contained in:
Vincent Petry 2021-05-25 15:47:09 +02:00 committed by GitHub
commit 0815be1ca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -318,14 +318,9 @@ class CacheJail extends CacheWrapper {
ISearchBinaryOperator::OPERATOR_AND, ISearchBinaryOperator::OPERATOR_AND,
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [$prefixFilter, $rootFilter]) , $query->getSearchOperation()] [new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [$prefixFilter, $rootFilter]) , $query->getSearchOperation()]
); );
$simpleQuery = new SearchQuery($operation, 0, 0, $query->getOrder(), $query->getUser()); $simpleQuery = new SearchQuery($operation, $query->getLimit(), $query->getOffset(), $query->getOrder(), $query->getUser());
$results = $this->getCache()->searchQuery($simpleQuery); $results = $this->getCache()->searchQuery($simpleQuery);
$results = $this->formatSearchResults($results); return $this->formatSearchResults($results);
$limit = $query->getLimit() === 0 ? null : $query->getLimit();
$results = array_slice($results, $query->getOffset(), $limit);
return $results;
} }
/** /**