Skip to content

ContactsMenu is querying and processing _all_ contacts #20009

Description

@georgehrke

The Manager of the ContactsMenu is currently querying all contacts, sorting them and filtering them.

$entries = $this->store->getContacts($user, $filter);

This is causing issues when a user has many contacts, possible also caused by a big system-addressbook. Instead of fetching all contacts right away, it would be better to pass down $limit, $offset and $sortBy the layers.

This would require breaking changes to the following interfaces:

  • OCP\Contacts\ContactsMenu\IContactsStore:

    public function getContacts(IUser $user, $filter);

    • Proposed changes:
      • add $limit, $offset and $sortBy
      • add constants to IContactsStore, which can be passed into $sortBy
  • OCP\Contacts\IManager

    public function search($pattern, $searchProperties = array(), $options = array());

    • Proposed changes:
      • add $limit, $offset and $sortBy
      • allow to sort by VCard Property name
  • OCP\Contacts\IAddressbook

    public function search($pattern, $searchProperties, $options);

    • Proposed changes:
      • add $limit, $offset and $sortBy
      • allow to sort by VCard Property name
  • OCA\DAV\CardDAV\CardDAVBackend

    public function search($addressBookId, $pattern, $searchProperties, $options = array()) {

    • Proposed changes:
      • option 1
        • add $limit, $offset and $sortBy as parameters
        • allow to sort by VCard Property name
      • option 2
        • allow to specificy $limit, $offset and $sortBy via existing $options parameter
        • allow to sort by VCard Property name

Possible problems we will run into:

  • Our implementation of OCP\Contacts\IManager::search calls OCP\Contacts\IAddressbook::search for every registered addressbook. Pagination over multiple sources is a problem.
    • Possible solution:
      • Only offer $limit, but no $offset.
        • Pros:
          • Applying $limit to multiple sources is no problem
          • serves all needs for current design of ContactsMenu
        • Cons:
          • Still no proper pagination, which would be nice to have for other use-cases.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions