chrissearle
Jun 10th, 2007, 02:19 PM
I'm getting some odd behaviour when I try and search only from a given point in the tree.
I'm calling the code like this:
ldapTemplate.search(groupRoot, activeMemberFilter, uniqueNamesMapper);
groupRoot looks like:
ou=SectionName,ou=GroupName,dc=domain,dc=tld
activeMemberFilter looks like:
(&(uniqueMember=*)(!(|(cn=Exclude1)(cn=Exclude2)(cn= Exclude3))))
When I do this - I get no results whatsoever.
But - I can run the command line search
ldapsearch -b 'ou=SectionName,ou=GroupName,dc=domain,dc=tld' '(&(uniqueMember=*)(!(|(cn=Exclude1)(cn=Exclude2)(cn= Exclude3))))'
and I get the correct results.
If I call it like this:
ldapTemplate.search("", activeMemberFilter, uniqueNamesMapper);
Then the search returns - gives me all the info I require and more (in other words - it returns the data from the whole tree - including the sub-tree I'm trying to search).
I've tried debugging. I get to the method in LdapTemplate
public void search(SearchExecutor se, NameClassPairCallbackHandler handler);
This has a try/catch/finally block. When the groupRoot is specified - then as soon as you call the se.executeSearch(ctx) flow goes to the finally block (no exception is caught) - it doesn't even hit the while() loop to see if there are any results.
I just can't see what I'm doing wrong :( I've tried some other simpler searches - any search where the base is not "" returns the empty set - any search where base is "" returns what I expect.
This is spring-ldap 1.1 retrieved via maven.
I could really do with some hints as to what I'm doing wrong here.
I'm calling the code like this:
ldapTemplate.search(groupRoot, activeMemberFilter, uniqueNamesMapper);
groupRoot looks like:
ou=SectionName,ou=GroupName,dc=domain,dc=tld
activeMemberFilter looks like:
(&(uniqueMember=*)(!(|(cn=Exclude1)(cn=Exclude2)(cn= Exclude3))))
When I do this - I get no results whatsoever.
But - I can run the command line search
ldapsearch -b 'ou=SectionName,ou=GroupName,dc=domain,dc=tld' '(&(uniqueMember=*)(!(|(cn=Exclude1)(cn=Exclude2)(cn= Exclude3))))'
and I get the correct results.
If I call it like this:
ldapTemplate.search("", activeMemberFilter, uniqueNamesMapper);
Then the search returns - gives me all the info I require and more (in other words - it returns the data from the whole tree - including the sub-tree I'm trying to search).
I've tried debugging. I get to the method in LdapTemplate
public void search(SearchExecutor se, NameClassPairCallbackHandler handler);
This has a try/catch/finally block. When the groupRoot is specified - then as soon as you call the se.executeSearch(ctx) flow goes to the finally block (no exception is caught) - it doesn't even hit the while() loop to see if there are any results.
I just can't see what I'm doing wrong :( I've tried some other simpler searches - any search where the base is not "" returns the empty set - any search where base is "" returns what I expect.
This is spring-ldap 1.1 retrieved via maven.
I could really do with some hints as to what I'm doing wrong here.