mail autocomplete default search filter is limited

VERIFIED FIXED in mozilla0.9.2


18 years ago
16 years ago


(Reporter: mozbugs, Assigned: dmose)



Firefox Tracking Flags

(Not tracked)


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



18 years ago
The default search value that mail autocomplete uses is:

Earlier products used:

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)

Comment 1

18 years ago
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. :)

Comment 2

18 years ago
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


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

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
    * 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.

Depends on: 77386
Priority: -- → P1
Target Milestone: --- → mozilla0.9.2

Comment 3

18 years ago
Note that the old syntax of %1 and %2 substitutions as mentioned by Phil (and
described at 


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


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

Comment 4

18 years ago
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

Comment 5

18 years ago
Actually, the patch will be in 77386.
PDT+ per 6/12 mtg.
Whiteboard: code in hand, patch forthcoming → [PDT+] code in hand, patch forthcoming

Comment 7

18 years ago
The fix for bug 77396 also improved the default search filter to:


Last Resolved: 18 years ago
Resolution: --- → FIXED

Comment 8

18 years ago
reassign Olga as QA contact
QA Contact: yulian → olgac

Comment 9

18 years ago
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
You need to log in before you can comment on or make changes to this bug.