-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Incorporate searchLimit in dedupe cacheKey #15185
Conversation
(Standard links)
|
73dd903
to
2394f39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question (see comment), otherwise this LGTM! 👍
(CiviCRM Review Template WORD-1.2)
- General standards
- Developer standards
api/v3/Dedupe.php
Outdated
@@ -107,7 +107,8 @@ function civicrm_api3_dedupe_getstatistics($params) { | |||
$params['rule_group_id'], | |||
CRM_Utils_Array::value('group_id', $params), | |||
CRM_Utils_Array::value('criteria', $params, []), | |||
CRM_Utils_Array::value('check_permissions', $params, []) | |||
CRM_Utils_Array::value('check_permissions', $params, []), | |||
CRM_Utils_Array::value('search_limit', $params, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these fallbacks make sense? Feels like it should be TRUE
or FALSE
for check_permissions
(not sure which, []
seems to have worked so far but that looks weird) and 0
for search_limit
.
When accessing dedupes by the api call or on the dedupe screen it's possible to pass in a searchLimit param. This works like the group limit in that it limits the number of contacts for whom a match is sought. For example if there are 2million contacts in the database and you have a search limit of 0 then it will look for duplicates for all 2 million. (unset is the same as 0). If you have a search limit of 1000 it will look for matches for the first 1000 contacts that match the criteria (criteria could be the group or other criteria passed in via the url although the api is the most obvious way to pass in criteria) Note there is a separate limit (sometimes called batch limit) that limits results from within the found matches. To test the searchLimit it is possible to add limit=5 to the url generated in the url by findContacts. Without this patch changing the limit once the search has been done will not alter the results as the limit is not part of the cachekey - this patch changes that.
2394f39
to
997a03f
Compare
Thanks @pfigel I changed search_limit to default to 0 and check_permissions to use !empty($params['check_permissions']) - which is consistent with elsewhere. Adding merge-on-pass |
This can safely be deployed in advance of the upgrade as it will be ignored civicrm/civicrm-core#15185 Change-Id: Id1ce52fa786ffe93b6829d68ade0d7afd902e68b
Overview
Fixes a bug whereby changing the search limit after a search has been performed does not result in a new search
Before
Altering the limit in the url after the initial retrieval has no effect
This can also be accessed via the api - without this patch running these 2 in sequence will result in the second call 'respecting' the limit from the first
After
Search limit is included in the cacheKey so if it changes the cache is refreshed.
Technical Details
When accessing dedupes by the api call or on the dedupe screen it's possible to pass in
a searchLimit param. This works like the group limit in that it limits the number of
contacts for whom a match is sought.
For example if there are 2million contacts in the database
and you have a search limit of 0 then it will look for duplicates for all 2 million. (unset
is the same as 0). If you have a search limit of 1000 it will look for matches for the first
1000 contacts that match the criteria (criteria could be the group or other criteria passed in
via the url although the api is the most obvious way to pass in criteria)
Note there is a separate limit (sometimes called batch limit) that limits results from within
the found matches. If you pass in
['options' => ['limit' => 10]]
via the api this will return 10 results if 10 or more exist. However, this limit has no effect on building the cache.To test the searchLimit it is possible to add limit=5 to the url generated in the
url by findContacts. Without this patch changing the limit once the search has been done
will not alter the results as the limit is not part of the cachekey - this patch
changes that.
Comments
@pfigel