Sort by multiple fields
Hi all, is it possible to sort over multiple fields?
I can successfully search on 1 attribute. When I try to search over 2 attributes, i get LDAP Error Code 2 - 00000057 javax.naming.CommunicationError.
I am using AD for my ldap purposes. Here is what i am trying to do:
AggregateDirContextProcessor processor = new AggregateDirContextProcessor processor();
SortControlDirContextProcessor sorter = new SortControlDirContextProcessor("sn");
SortControlDirContextProcessor sorter2 = new SortControlDirContextProcessor("givenName");
Works if I just feed processor sorter. Does not work if I feed it sorter and sorter2.
My first post was using spring-ldap-1.2.1 to clarify.
I tried "upgrading" to spring-ldap-1.3.0 and I could no longer get any sorting to work with this code as I got a reflection/can not find method error. I was looking through the source for the 1.3.0 release, and the error occurs when it is looking for the isSorted method. Here is a mini-trace:
AbstractFallbackRequestAndResponseControlDir.invok eMethod: line 133
SortControlDirContextProcessor.handleResponse: line 116
Right, seems to put the finger on a implementation flaw. The problem is that if you want to sort on several fields you need to send all the fields in a String array. The SortControlDirContextProcessor currently doesn't allow that, which is obviously wrong. Looking at the source of SortControlDirContextProcessor it should be pretty easy to device your own implementation that works like this. Nevertheless it should be fixed in the Spring LDAP code as well. Please file a jira issue on this.