[Date Prev][Date Next]
Re: How to do a case insensitive substring search on a case-sensitive field ?
Guillermo-Nicolas Guénon Díaz wrote:
[First of all, sorry if this question has already been answered before: the
search on this mailing list does not work currently so I haven't been able to
google site:www.openldap.org substring search
I need to write a filter so that when the user of my software introduces any
substring of the content of a field in any case (upper, lower or mixed case),
it finds the entry. It must work even if the user does not input a complete
word, but just a part of a word.
The field is called "supName" and it follows the DirectoryString syntax. This
means that the default matching rule is exact and case sensitive
("caseExactMatch"). But according to:
, this syntax should allow also "caseIgnoreMatch" and
"caseIgnoreSubstringsMatch" matching rules. I though I just needed to force to
use the last one ("caseIgnoreSubstringsMatch"), so I tried this filter:
But this does not work. I make my tests using Apache Directory Studio, and
that tool refuses to accept the above filter. It complains on the asterisks,
and I don't understand why, since I am using a Substring match (and thus
asterisks should be allowed). If I run the filter from command line (using
ldapsearch), I get this error message:
ldap_search_ext: Bad search filter (-7)
Therefore this is not an issue with Apache Directory Studio.
So my question is: What is the correct way of defining a case-insensitive
substring filter on a field that is case-sensitive by default?
Looks to me like you can't. In the grammar for search filters in RFC4511 a
filter term may be a substringFilter or an extensibleMatch but not both at
once. In particular, the MatchingRuleAssertion allows a single AssertionValue,
and a SubstringFilter is a SEQUENCE of AssertionValues.
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/