What is the optimal LDAP Query or Queries for searching for users by name? -
given input free-form search field, need query ldap system , return user records. our ldap schema includes "preferredname". possible valid inputs include: "lastname", "givenname", "preferredname lastname", "lastname, preferredname", "givenname lastname", etc., including such variations multiple-word last names (with or without hyphens).
our current less-than-optimal process splits out individual words, makes assumptions order (based on presence or absence of comma) , makes several simple ldap queries (e.g.: "john smith" submit following queries:
(&(objectclass=person)(sn=*smith*)(preferredname=*john*)) (&(objectclass=person)(givenname=*john*)(sn=*smith*))
we amalgamate , de-dupe results of multiple queries. single-query solution preferable, if query complex. basic understanding of ldap query syntax, string every possible permutation of name words 1 gigantic query, i'm hoping there's more elegant solution.
that's ok long attributes indexed. can combine queries 1 | operator, ldap server de-dupe you, , have less network traffic, latency, etc.
Comments
Post a Comment