Only normalize search term when searching in 'words' column

pull/229/merge
Thomas Bruederli 10 years ago
parent 3bd0277261
commit 8e333bcb66

@ -355,7 +355,7 @@ class rcube_contacts extends rcube_addressbook
} }
else { else {
// require each word in to be present in one of the fields // require each word in to be present in one of the fields
foreach (rcube_utils::normalize_string($value, true) as $word) { foreach (rcube_utils::tokenize_string($value, 1) as $word) {
$groups = array(); $groups = array();
foreach ((array)$fields as $idx => $col) { foreach ((array)$fields as $idx => $col) {
$groups[] = $this->fulltext_sql_where($word, $mode, $col); $groups[] = $this->fulltext_sql_where($word, $mode, $col);
@ -446,9 +446,10 @@ class rcube_contacts extends rcube_addressbook
{ {
$WS = ' '; $WS = ' ';
$AS = $col == 'words' ? $WS : self::SEPARATOR; $AS = $col == 'words' ? $WS : self::SEPARATOR;
$words = $col == 'words' ? rcube_utils::normalize_string($value, true) : array($value);
$where = array(); $where = array();
foreach (rcube_utils::normalize_string($value, true) as $word) { foreach ($words as $word) {
switch ($mode) { switch ($mode) {
case 1: // strict case 1: // strict
$where[] = '(' . $this->db->ilike($col, $word . '%') $where[] = '(' . $this->db->ilike($col, $word . '%')

Loading…
Cancel
Save