[Date Prev][Date Next] [Chronological] [Thread] [Top]

How to do a case insensitive substring search on a case-sensitive field ?



Hello,

[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 check.]

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:
http://www.zytrax.com/books/ldap/apa/types.html
, 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:

(supName:caseIgnoreSubstringsMatch:=*somesubstring*)

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?

Yesterday I filled a question in StackOverflow regarding this same issue. There are more details and examples in that question:
http://stackoverflow.com/questions/25290494/case-insensitive-substring-ldap-search-on-openldap-2-4-33

Any help would be greatly appreciated !

Thank you very much.

Nicolas