Skip to content

Commit

Permalink
Merge pull request #27062 from nextcloud/search-limit-offset-jail
Browse files Browse the repository at this point in the history
properly use limit and offset for search in Jail wrapper
  • Loading branch information
PVince81 authored May 25, 2021
2 parents 333665b + 7ee528f commit 0815be1
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/private/Files/Cache/Wrapper/CacheJail.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,9 @@ public function searchQuery(ISearchQuery $query) {
ISearchBinaryOperator::OPERATOR_AND,
[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->formatSearchResults($results);

$limit = $query->getLimit() === 0 ? null : $query->getLimit();
$results = array_slice($results, $query->getOffset(), $limit);

return $results;
return $this->formatSearchResults($results);
}

/**
Expand Down

0 comments on commit 0815be1

Please sign in to comment.