Results 1 to 4 of 4

Thread: Sort by multiple fields

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    4

    Default 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");
    processor.addDirContextProcessor(sorter);
    processor.addDirContextProcessor(sorter2);

    Works if I just feed processor sorter. Does not work if I feed it sorter and sorter2.

  2. #2
    Join Date
    Jan 2009
    Posts
    4

    Default Additional Info

    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

  3. #3
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    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.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  4. #4

    Default Issue fixed?

    Is this issue fixed?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •