[turba] how to search addressbooks with a multi word query?
Ben Poliakoff
benp at reed.edu
Fri Feb 18 17:17:21 PST 2005
I'd really like to figure out a way to get Turba to parse multi word
search queries with an implicit AND. This would especially useful when
searching a large LDAP directory.
Currently Turba (I'm using CVS HEAD) takes a search query as a single
literal value. Is there an obvious way for it to take a search query as
a whitespace delimited list of strings which could then be cumulatively
constructed into an "AND" query against the addressbook?
Here's an example:
I'm trying to look up the email address for someone whose first name is
is really long; I don't know how to spell it, but I know it starts with
a "T" and I know this person's last name is "Smith".
So I try typing in "T Smith" into the Turba search field but come up
empty handed because the resulting search query is for:
"*T Smith*" in fullname, firstname, lastname
rather than
"*T*" AND "*Smith*" in fullname, firstname, lastname
Assuming I'm searching a Turba "composite" field composed of cn, gn, and sn;
when I do a Turba query for "T Smith" I get an LDAP query that looks like
this:
"(&(|(cn=*T Smith*)(gn=*T Smith*)(sn=*T Smith*)))"
i.e.: cn, gn, or sn contains "T Smith" (the initial "(&" seems to be
superfluous since the filter only has one condition)
I'd really like to break along whitespace and create a filter more like
this:
"(&(|(cn=*T*)(gn=*T*)(sn=*T*))(|(cn=*Smith*)(gn=*Smith*)(sn=*Smith*)))"
i.e.: cn, gn, or sn contains "T" AND "Smith"
This latter version of the filter is the approach that Thunderbird and
Apple Mail seem to take. And it works pretty well in those apps.
Has anyone else tried to do this in Turba?
In looking through the archives I couldn't find anyone talking about
this issue (except me back in 2003!). Would other people be interested
in this functionality? I don't have a tremendous amount of php
experience so it's hard for me to determine how difficult this would
be to implement. I *can* tell that it's a little more involved than
setting up composite fields in turba/config/sources.php!
Ben
More information about the turba
mailing list