From 72f680681075f9d57e3ebfd7fc99ed965f7f8c24 Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Sun, 28 Sep 2003 11:06:44 +0000 Subject: [PATCH] fix for bug [ 805146 ] ldap addressbook query slow https://sourceforge.net/tracker/?func=detail&atid=554338&aid=805146&group_id=78745 --- phpgwapi/inc/class.contacts_ldap.inc.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/class.contacts_ldap.inc.php b/phpgwapi/inc/class.contacts_ldap.inc.php index 79b501fae0..cc71c4c76c 100644 --- a/phpgwapi/inc/class.contacts_ldap.inc.php +++ b/phpgwapi/inc/class.contacts_ldap.inc.php @@ -395,9 +395,22 @@ $myfilter = ''; if($query) - { - reset($this->stock_contact_fields); - $myfilter = $this->makefilter($filterfields,$this->stock_contact_fields,$query,$DEBUG); + { + // the old code was searching about all fields + // this was very slow + #reset($this->stock_contact_fields); + #$myfilter = $this->makefilter($filterfields,$this->stock_contact_fields,$query,$DEBUG); + + // don't search about any fields any more + $search_filter = array( + 'fn' => 'cn', + 'n_given' => 'givenname', + 'n_family' => 'sn', + 'email' => 'mail', + 'org_name' => 'o', + 'org_unit' => 'ou' + ); + $myfilter = $this->makefilter($filterfields,$search_filter,$query,$DEBUG); } else {