Skip to content

Commit

Permalink
CRM-18694 alternative solution to easier post code searching.
Browse files Browse the repository at this point in the history
The proposal is to change it to regex but the comments suggest the primary reason for this is that it makes more sense to search from the start of the string. This being the case it seems that we could opt to use an indexed query rather than regex
  • Loading branch information
eileenmcnaughton committed Jul 12, 2016
1 parent 926f6ae commit 12af7ad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CRM/Contact/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,9 @@ public static function getDedupes() {

foreach ($mappings as $key => $dbName) {
if (!empty($searchParams[$key])) {
$queryParams[$nextParamKey] = array('%' . $searchParams[$key] . '%', 'String');
// CRM-18694.
$wildcard = strstr($key, 'postcode') ? '' : '%';
$queryParams[$nextParamKey] = array($wildcard . $searchParams[$key] . '%', 'String');
$where[] = $dbName . " LIKE %{$nextParamKey} ";
$nextParamKey++;
}
Expand Down

0 comments on commit 12af7ad

Please sign in to comment.