From 12af7addc319da3b5cb4555787d8a1b1bd7efa12 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 23 Jun 2016 15:17:50 +1200 Subject: [PATCH] CRM-18694 alternative solution to easier post code searching. 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 --- CRM/Contact/Page/AJAX.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index 2da17695ea..f6e17e8eb4 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -688,7 +688,9 @@ LIMIT {$offset}, {$rowCount} 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++; } -- 2.25.1