diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-01-10 18:06:44 +0300 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-10-14 15:02:08 +0300 |
commit | b66f4cf2dc9b633fcf3ade268901aff36ebe936b (patch) | |
tree | c078f21ff6ceb0532f8f6555389a6591f2014d76 /lib | |
parent | 7768388816bd41455655ba2b5e4c8eb0f0b2e290 (diff) |
Use paginated search for contacts
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Collaboration/Collaborators/MailPlugin.php | 3 | ||||
-rw-r--r-- | lib/private/Collaboration/Collaborators/RemotePlugin.php | 3 | ||||
-rw-r--r-- | lib/private/ContactsManager.php | 2 | ||||
-rw-r--r-- | lib/public/Contacts/IManager.php | 2 | ||||
-rw-r--r-- | lib/public/IAddressBook.php | 2 |
5 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index f4af4737c1a..d5ee407b82f 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -81,8 +81,7 @@ class MailPlugin implements ISearchPlugin { $emailType = new SearchResultType('emails'); // Search in contacts - //@todo Pagination missing - $addressBookContacts = $this->contactsManager->search($search, ['EMAIL', 'FN']); + $addressBookContacts = $this->contactsManager->search($search, ['EMAIL', 'FN'], ['limit' => $limit, 'offset' => $offset]); $lowerSearch = strtolower($search); foreach ($addressBookContacts as $contact) { if (isset($contact['EMAIL'])) { diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php index 5173e889b9c..5cbecf5385b 100644 --- a/lib/private/Collaboration/Collaborators/RemotePlugin.php +++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php @@ -68,8 +68,7 @@ class RemotePlugin implements ISearchPlugin { $resultType = new SearchResultType('remotes'); // Search in contacts - //@todo Pagination missing - $addressBookContacts = $this->contactsManager->search($search, ['CLOUD', 'FN']); + $addressBookContacts = $this->contactsManager->search($search, ['CLOUD', 'FN'], ['limit' => $limit, 'offset' => $offset]); foreach ($addressBookContacts as $contact) { if (isset($contact['isLocalSystemBook'])) { continue; diff --git a/lib/private/ContactsManager.php b/lib/private/ContactsManager.php index ba709baefe5..427f2f6772a 100644 --- a/lib/private/ContactsManager.php +++ b/lib/private/ContactsManager.php @@ -39,6 +39,8 @@ namespace OC { * @param array $searchProperties defines the properties within the query pattern should match * @param array $options = array() to define the search behavior * - '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 */ public function search($pattern, $searchProperties = array(), $options = array()) { diff --git a/lib/public/Contacts/IManager.php b/lib/public/Contacts/IManager.php index 9dd19c4cbf4..fe462627fc0 100644 --- a/lib/public/Contacts/IManager.php +++ b/lib/public/Contacts/IManager.php @@ -95,6 +95,8 @@ interface IManager { * @param array $searchProperties defines the properties within the query pattern should match * @param array $options = array() to define the search behavior * - '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 * @since 6.0.0 */ diff --git a/lib/public/IAddressBook.php b/lib/public/IAddressBook.php index 4f652706d57..c39fb3fd1a9 100644 --- a/lib/public/IAddressBook.php +++ b/lib/public/IAddressBook.php @@ -70,6 +70,8 @@ namespace OCP { * - '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: * [ |