diff options
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/CardDAV/AddressBookImpl.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/CardDavBackend.php | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index 5e355611c11..3eea0f1d5c8 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -105,6 +105,8 @@ class AddressBookImpl implements IAddressBook { * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] * - 'escape_like_param' - If set to false wildcards _ and % are not escaped + * - 'limit' - Set a numeric limit for the search results + * - 'offset' - Set the offset for the limited search results * @return array an array of contacts which are arrays of key-value-pairs * example result: * [ diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index f4de1b717fb..87e8e11cd16 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -965,6 +965,12 @@ class CardDavBackend implements BackendInterface, SyncSupport { $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); } } + if (isset($options['limit'])) { + $query2->setMaxResults($options['limit']); + } + if (isset($options['offset'])) { + $query2->setFirstResult($options['offset']); + } $query->select('c.carddata', 'c.uri')->from($this->dbCardsTable, 'c') ->where($query->expr()->in('c.id', $query->createFunction($query2->getSQL()))); |