Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contactsmanager shall limit number of results early #22057

Merged
merged 1 commit into from Aug 3, 2020

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Jul 30, 2020

fixes #20009 cf. #20009 (comment)

Optional arguments are added to the ContactsStore API, so it should be okay to backport it to 19. Support for limiting results is implemented down the stack already. Since the contactsmenu reduces results according to sharing.maxAutocompleteResults and the search filter is passed to the backend, limiting the possible results up front does not sacrifice anything, but improves performance.

@blizzz
Copy link
Member Author

blizzz commented Jul 30, 2020

/backport to stable19

@blizzz blizzz requested review from ChristophWurst and removed request for ChristophWurst July 30, 2020 10:55
@blizzz blizzz force-pushed the fix/20009/contactsmenu-limit-users branch from 7828a92 to 646820b Compare July 30, 2020 11:02
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz blizzz force-pushed the fix/20009/contactsmenu-limit-users branch from 646820b to 7c56283 Compare July 31, 2020 10:42
Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good and makes sense 👍

@faily-bot

This comment has been minimized.

Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐘

@MorrisJobke MorrisJobke merged commit 489feca into master Aug 3, 2020
@MorrisJobke MorrisJobke deleted the fix/20009/contactsmenu-limit-users branch August 3, 2020 13:15
@blizzz
Copy link
Member Author

blizzz commented Oct 13, 2020

/backport to stable18

@ChristophWurst
Copy link
Member

ChristophWurst commented Nov 2, 2023

not sacrifice anything, but improves performance.

The limit is passed down, but not the sort order. So the result correctness is only given if database sorts the same way as the PHP code does later on.

Let's say you have 100 contacts. The database sorts them by UID. You select the first 20 rows, then sort the rows by name. It's not the same result as fetching all 100 contacts, sorting them and then taking the first 20 entries.

SELECT DISTINCT `cp`.`cardid` FROM `oc_cards_properties` `cp` WHERE (`cp`.`addressbookid` = :id) AND ((`cp`.`name` = 'EMAIL') OR (`cp`.`name` = 'FN')) LIMIT 25; is the query run on the DB.

@blizzz
Copy link
Member Author

blizzz commented Nov 2, 2023

You have (still) too many results 😅

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

Successfully merging this pull request may close these issues.

ContactsMenu is querying and processing _all_ contacts
6 participants