Full_Name: Kristian McColm Version: slapd 2.4.40 OS: RHEL 6.8 URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (162.208.80.0)
With an attribute type defined in the schema and index as per the below, and the value of the attribute set to 0, the lessOrEqual filter does not work as expected.
Schema attribute: olcAttributeTypes: {1} ( <oid> NAME 'num' DESC 'Numeric Attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'user defined' EQUALITY integerMatch ORDERING integerOrderingMatch )
Index attribute: olcDbIndex: num eq,pres
Less or Equal does not work:
$ ldapsearch -x -h localhost -p 389 -b "uid=bob,dc=test,dc=com" '(num<=1)' # extended LDIF # # LDAPv3 # base <uid=bob,dc=test,dc=com> with scope subtree # filter: (num<=1) # requesting: ALL #
# search result search: 2 result: 0 Success
# numResponses: 1
Equality match works however:
$ ldapsearch -x -h localhost -p 389 -b "uid=bob,dc=test,dc=com" '(num=0)' # extended LDIF # # LDAPv3 # base <uid=bob,dc=test,dc=com> with scope subtree # filter: (num=0) # requesting: ALL #
dn: uid=bob,dc=test,dc=com objectClass: top objectClass: testObjectClass uid: bob num: 0
# numResponses: 2 # numEntries: 1
And with a non-zero value for 'num' lessOrEqual works as expected:
$ ldapsearch -x -h localhost -p 389 -b "uid=bob,dc=test,dc=com" '(num<=10)' # extended LDIF # # LDAPv3 # base <uid=bob,dc=test,dc=com> with scope subtree # filter: (num<=10) # requesting: ALL #
dn: uid=bob,dc=test,dc=com objectClass: top objectClass: testObjectClass uid: bob num: 1
# numResponses: 2 # numEntries: 1