Closed Bug 85315 Opened 23 years ago Closed 23 years ago

mail autocomplete default search filter is limited

Categories

(Directory :: LDAP XPCOM SDK, defect, P1)

defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: mozbugs, Assigned: dmosedale)

References

Details

(Whiteboard: [PDT+] code in hand, patch forthcoming)

The default search value that mail autocomplete uses is:
(|(cn=value*)(sn=value*))

Earlier products used:
(|(cn=value*)(mail=value*)(sn=value*))

Having mail in there is useful and should be included.

I would also argue that the cn check should be (cn=*value*), but that's 
debatable. Currently, looking up someone whose cn and sn have a different last 
name doesn't catch the last name in the cn - (look for our favorite newly 
inducted lady Swede in the pb directory, for example)
I would agree as well that the cn search should be cn=*value*. It usually is a 
good assumption that the sn is a substring of the cn, but for some people (right 
now) it's not. And I'm a good example. :)
There will soon be a patch in 77386 that allows the user to specify his or her
own filter template via hidden preference.  Right now, the default I'm using is

(|(cn=%v*)(mail=%v*)(sn=%v*))

This is pretty much what 4.x uses.  I ask Phil Peterson about the 4.x algorithm
and default, and he sent me the following, which I'm posting here with his
permission:

I went back and reread the code. It really shows the signs of having VLV added
~two years after the original filter code was written -- I'm sure there are
cleaner ways to express what it does. Anyway, here are some notes:

    * The basic structure of the autocomplete filter, in the general case, is
(|(cn=phil*)(mail=phil*)(sn=phil*))
    * There are a bunch of tweaky things which can happen along the way.
Starting at the beginning, in terms of the call chain
          * In 4.5+, one attribute name can expand to several attributes in the
directory. The reason we did this (at Nortel's request) was that they had
several attributes containing email addresses in their directory (e.g. mail,
outlookMail, email, and on and on). But in Communicator's mind, there's only one
mail attribute in the UI. So in this code, we build a separate filter for each
expanded attribute, e.g. (|(mail=phil*)(outlookMail=phil*)(email=phil*)). This
is why DIR_GetAttributeStrings is plural.
          * In order to solve the name stem problem, we transform spaces into
stars. The intent is that if you're in the directory as "Daniel Mosedale",
(cn=dan*mose*) will match, but (cn=dan mose*) will not, which is a problem you
can see in the Phone Book application.
          * An alternate solution to the problem of what to do with spaces is to
allow the filter to be built separately for each space-separated word the user
types. This was originally intended to be used when IS admins specified their
own custom search filter, rather than allowing us to build the filter. If the
the user typed "value1 value2" we would generate (|(foo=value1*value2*)). If you
had a custom filter like  (|(foo=%1)(bar=%2)) you might want the expansion to be
(|((|(foo=value1*)(bar=value1*)) (|(foo=value2*)(bar=value2*))). So, there's
some tokenization code which does this "repeat filter for words" logic. This was
broken at one point in 4.0x, so I suspect it wasn't ever really used.
          * The custom filter code looks straightforward enough -- it just does
parameter substitution like printf, except using numbered IDs for the parameters.

Status: NEW → ASSIGNED
Depends on: 77386
Priority: -- → P1
Target Milestone: --- → mozilla0.9.2
Note that the old syntax of %1 and %2 substitutions as mentioned by Phil (and
described at 

<http://docs.iplanet.com/docs/manuals/communicator/ldap45.htm#typedown-and-autocomplete>


is going away.  It's being replaced by the more standard syntax used by
ldapfilter.conf(3) and described at

<http://docs.iplanet.com/docs/manuals/dirsdk/csdk41/html/filter.htm>

Leif, do you have any comments on what the default should be?
OS: Mac System 9.x → All
Hardware: Macintosh → All
Summary: mail autocomplete uses limited search filter → mail autocomplete default search filter is limited
OK, I've got working code in my tree.  Need to sand the corners off a few edge
cases; then I'll attach a patch here.
Whiteboard: code in hand, patch forthcoming
Actually, the patch will be in 77386.
PDT+ per 6/12 mtg.
Whiteboard: code in hand, patch forthcoming → [PDT+] code in hand, patch forthcoming
The fix for bug 77396 also improved the default search filter to:

(|(cn=%v*)(mail=%v*)(sn=%v*))

Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
reassign Olga as QA contact
QA Contact: yulian → olgac
default search filter (|(cn=%v*)(mail=%v*)(sn=%v*)) works.
Verified on WinNT 4.0, MacOS 9.1, Linux RH 7.1 with  2001062004, 2001062008, 
2001062111 builds
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.