From db390a27fbab2e753bd17ed11cdc3be9d84612f7 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 14 Sep 2015 14:09:17 -0400
Subject: [PATCH] Do not tokenize search string when querying in strict mode (#1490504)
---
program/lib/Roundcube/rcube_contacts.php | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php
index 2c37c70..4bdec18 100644
--- a/program/lib/Roundcube/rcube_contacts.php
+++ b/program/lib/Roundcube/rcube_contacts.php
@@ -281,7 +281,7 @@
/**
* Search contacts
*
- * @param mixed $fields The field name of array of field names to search in
+ * @param mixed $fields The field name or array of field names to search in
* @param mixed $value Search value (or array of values when $fields is array)
* @param int $mode Matching mode:
* 0 - partial (*abc*),
@@ -349,7 +349,8 @@
}
else {
// require each word in to be present in one of the fields
- foreach (rcube_utils::tokenize_string($value, 1) as $word) {
+ $words = $mode == 1 ? array($value) : rcube_utils::tokenize_string($value, 1);
+ foreach ($words as $word) {
$groups = array();
foreach ((array)$fields as $idx => $col) {
$groups[] = $this->fulltext_sql_where($word, $mode, $col);
--
Gitblit v1.9.1