Change LDAP autocomplete default minStringLength to only autocomplete against strings >= 2 chars long to avoid a possible hang on NT as well as unindexed searches (bug 84566; r=leif@netscape.com, sr=darin@netscape.com) and default searchFilterTemplate to catch people whose cn contains their middle name or initial (bug 90535; r=leif@netscape.com, rs=darin@netscape.com). This second patch also fixes a bug where filter templates sometimes ignored the last token of the entered string

This commit is contained in:
dmose%netscape.com 2001-07-25 04:15:30 +00:00
parent 9465aa7f97
commit 31d4fa1710
3 changed files with 26 additions and 6 deletions

View File

@ -974,7 +974,17 @@ nsLDAPService::CountTokens(nsReadingIterator<PRUnichar> aIter,
++aIter; // move past the space
break;
}
++aIter; // move to next char and continue with this token
++aIter; // move to next char
// if we've hit the end of this token and the end of this
// iterator simultaneous, be sure to bump the count, since we're
// never gonna hit the IsAsciiSpace where it's normally done.
//
if (aIter == aIterEnd) {
++count;
}
}
}

View File

@ -36,8 +36,15 @@ interface nsILDAPAutoCompleteSession : nsIAutoCompleteSession {
* A template used to construct the RFC 1960 LDAP search filter to use
* while autocompleting.
*
* XXX syntax to-be-determined in an upcoming checkin
*
* The authoritative documentation for the format in use can be found at
* at <http://docs.iplanet.com/docs/manuals/dirsdk/csdk41/html/filter.htm>.
* The Linux/OpenLDAP man page for ldapfilter.conf(5) does a pretty decent
* job as well, however.
*
* As of this writing, the "@mozilla.org/autocompleteSession;1?type=ldap"
* contractid happens to use a default value of
* (|(cn=%v1*%v2-*)(mail=%v1*%v2-*)(sn=%v1*%v2-*))
*
* @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
* @exception NS_ERROR_OUT_OF_MEMORY Getter couldn't allocate string
*/
@ -90,7 +97,9 @@ interface nsILDAPAutoCompleteSession : nsIAutoCompleteSession {
* configured to not search on substrings so short that they
* aren't indexed by the LDAP server (such searches can use significantly
* more server resources and return a very large number of entries).
* The default is 0, meaning that no such limit is in effect.
* As of this writing, the "@mozilla.org/autocompleteSession;1?type=ldap"
* contractid uses a default of two, as this avoids unindexed searches
* with at least one widely-deployed webserver.
*
* @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
*/

View File

@ -50,8 +50,9 @@ NS_IMPL_ISUPPORTS3(nsLDAPAutoCompleteSession, nsIAutoCompleteSession,
nsLDAPAutoCompleteSession::nsLDAPAutoCompleteSession() :
mState(UNBOUND),
mFilterTemplate(NS_LITERAL_STRING("(|(cn=%v*)(mail=%v*)(sn=%v*))")),
mMaxHits(100), mMinStringLength(0), mSearchAttrs(0), mSearchAttrsSize(0)
mFilterTemplate(NS_LITERAL_STRING(
"(|(cn=%v1*%v2-*)(mail=%v1*%v2-*)(sn=%v1*%v2-*))")),
mMaxHits(100), mMinStringLength(2), mSearchAttrs(0), mSearchAttrsSize(0)
{
NS_INIT_ISUPPORTS();
}