Merge pull request #27561 from nextcloud/dav-search-offset

allow setting offset for dav search queries not limited to the users home storage
pull/27269/head
blizzz 2021-06-23 11:27:41 +07:00 committed by GitHub
commit 6c65c9c44d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

@ -272,10 +272,9 @@ class FileSearchBackend implements ISearchBackend {
* @return ISearchQuery * @return ISearchQuery
*/ */
private function transformQuery(Query $query): ISearchQuery { private function transformQuery(Query $query): ISearchQuery {
// TODO offset
$limit = $query->limit; $limit = $query->limit;
$orders = array_map([$this, 'mapSearchOrder'], $query->orderBy); $orders = array_map([$this, 'mapSearchOrder'], $query->orderBy);
$offset = 0; $offset = $limit->firstResult;
$limitHome = false; $limitHome = false;
$ownerProp = $this->extractWhereValue($query->where, FilesPlugin::OWNER_ID_PROPERTYNAME, Operator::OPERATION_EQUAL); $ownerProp = $this->extractWhereValue($query->where, FilesPlugin::OWNER_ID_PROPERTYNAME, Operator::OPERATION_EQUAL);
@ -285,7 +284,6 @@ class FileSearchBackend implements ISearchBackend {
} else { } else {
throw new \InvalidArgumentException("Invalid search value for '{http://owncloud.org/ns}owner-id', only the current user id is allowed"); throw new \InvalidArgumentException("Invalid search value for '{http://owncloud.org/ns}owner-id', only the current user id is allowed");
} }
$offset = $limit->firstResult;
} }
return new SearchQuery( return new SearchQuery(