[CalendarServer-changes] [11585] CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 6 12:22:01 PDT 2013
Revision: 11585
http://trac.calendarserver.org//changeset/11585
Author: sagen at apple.com
Date: 2013-08-06 12:22:01 -0700 (Tue, 06 Aug 2013)
Log Message:
-----------
Don't also search on the guidAttr since it can actually slow things down.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
Modified: CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py 2013-08-06 19:02:14 UTC (rev 11584)
+++ CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py 2013-08-06 19:22:01 UTC (rev 11585)
@@ -1071,7 +1071,7 @@
% (recordTypes, indexType, indexKey))
- def recordsMatchingTokens(self, tokens, context=None, limitResults=50, timeoutSeconds=30):
+ def recordsMatchingTokens(self, tokens, context=None, limitResults=50, timeoutSeconds=10):
"""
# TODO: hook up limitResults to the client limit in the query
@@ -1097,7 +1097,6 @@
records = []
recordTypes = self.recordTypesForSearchContext(context)
recordTypes = [r for r in recordTypes if r in self.recordTypes()]
- guidAttr = self.rdnSchema["guidAttr"]
typeCounts = {}
for recordType in recordTypes:
@@ -1108,7 +1107,7 @@
base = self.typeDNs[recordType]
scope = ldap.SCOPE_SUBTREE
filterstr = buildFilterFromTokens(recordType, self.rdnSchema[recordType]["mapping"],
- tokens, ("(%s=*)" % (guidAttr,)))
+ tokens)
if filterstr is not None:
# Query the LDAP server
@@ -1429,7 +1428,7 @@
return filterstr
-def buildFilterFromTokens(recordType, mapping, tokens, extras=()):
+def buildFilterFromTokens(recordType, mapping, tokens):
"""
Create an LDAP filter string from a list of query tokens. Each token is
searched for in each LDAP attribute corresponding to "fullName" and
@@ -1445,7 +1444,7 @@
"""
filterStr = None
- tokens = [ldapEsc(t) for t in tokens]
+ tokens = [ldapEsc(t) for t in tokens if len(t) > 2]
if len(tokens) == 0:
return None
@@ -1468,7 +1467,6 @@
return None
tokenFragments = []
- tokenFragments.extend(extras)
for token in tokens:
fragments = []
@@ -1488,7 +1486,6 @@
return filterStr
-
class LdapDirectoryRecord(CachingDirectoryRecord):
"""
LDAP implementation of L{IDirectoryRecord}.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130806/ade84cbb/attachment.html>
More information about the calendarserver-changes
mailing list