summaryrefslogtreecommitdiff
path: root/plugins/kolab_addressbook
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-03-03 16:05:20 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-03-03 16:05:20 (GMT)
commitac96c929dd6650e18f664850dffe1e6f5a2b08da (patch)
treeac1b956b11cc05bf8354d2ec9b826deecb4dc7d8 /plugins/kolab_addressbook
parentae2bd007329ada3384d995017dbf4afe1fa6de1f (diff)
downloadroundcubemail-plugins-kolab-ac96c929dd6650e18f664850dffe1e6f5a2b08da.tar.gz
Improve contacts search by matching words against contact properties instead of the entire search string
Diffstat (limited to 'plugins/kolab_addressbook')
-rw-r--r--plugins/kolab_addressbook/lib/rcube_kolab_contacts.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index 1b3ea01..c618b10 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -467,26 +467,26 @@ class rcube_kolab_contacts extends rcube_addressbook
}
$found = array();
+ $contents = '';
foreach (preg_grep($regexp, array_keys($contact)) as $col) {
$pos = strpos($col, ':');
$colname = $pos ? substr($col, 0, $pos) : $col;
- $search = $advanced ? $value[array_search($colname, $fields)] : $value;
foreach ((array)$contact[$col] as $val) {
- if ($this->compare_search_value($colname, $val, $search, $mode)) {
- if (!$advanced) {
- $this->filter['ids'][] = $id;
- break 2;
- }
- else {
- $found[$colname] = true;
- }
+ if ($advanced) {
+ $found[$colname] = $this->compare_search_value($colname, $val, $value[array_search($colname, $fields)], $mode);
+ }
+ else {
+ $contents .= ' ' . join(' ', (array)$val);
}
}
}
- if (count($found) >= $scount) // && $advanced
+ // compare matches
+ if (($advanced && count($found) >= $scount) ||
+ (!$advanced && rcube_utils::words_match(mb_strtolower($contents), $value))) {
$this->filter['ids'][] = $id;
+ }
}
// dummy result with contacts count