directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tamsin Slinn <tam.sl...@gmail.com>
Subject Re: How to do a sorted search using Apache Directory API
Date Thu, 07 Mar 2019 21:36:52 GMT
Hi
Thanks for the reply.
I tried with both 1.0.2 and 2.0.0.AM2 with the same outcome.
The output from the Java code was as below (I just have a local ldap with a
few users for testing)

sn: Trainee
sn: Admin
sn: User
sn: Supervisor

I did not know about the slapo-sssvlv overlay, my LDAP knowledge is basic -
I am running OpenLDAP from the docker image openfrontier/openldap-server
I tried to install it - I successfully loaded the ldif below. Now when I
run the original code I get no results at all. If I remove the SortRequest
control from the SearchRequest it returns me the expected results.

> dn: cn=module{0}, cn=config
> changetype: modify
> add: olcModuleLoad
> olcModuleLoad: sssvlv.la
>
> dn: olcOverlay=sssvlv,olcDatabase={1}hdb,cn=config
> changetype: add
> objectClass: olcSssVlvConfig
> olcSssVlvMax: 10
> olcSssVlvMaxKeys: 5

Is this the correct way to install the slapo-sssvlv overlay? I am not sure
how to provide it's configuration sorry.

Thanks




On Thu, Mar 7, 2019 at 4:08 PM Emmanuel L├ęcharny <elecharny@gmail.com>
wrote:

>
> On 07/03/2019 10:40, Tamsin Slinn wrote:
> > Hi,
> > I hope this is an OK question to post to the list.
>
>
> That's fine.
>
>
> >
> > I'm running the code below against OpenLDAP 2.4.40. I based the code on
> an
> > integration test for SortRequestControl. However, this code does not
> return
> > the entries in the order I expect (alphabetical by sn). Can you tell me
> > what I am missing?
> > Thanks for any help!
> >
> >      SearchRequest req = new SearchRequestImpl();
> >      req.setScope(SearchScope.ONELEVEL);
> >      req.addAttributes("*");
> >      req.setTimeLimit(0);
> >      req.setBase(searchDn);
> >      req.setFilter("(objectclass=posixAccount)");
> >
> >      SortRequest sortRequest = new SortRequestControlImpl();
> >      sortRequest.addSortKey(new SortKey("sn"));
> >      req.addControl(sortRequest);
> >
> >     try (SearchCursor cursor = connection.search(req)) {
> >           while (cursor.next()) {
> >                  SearchResultEntry se = (SearchResultEntry) cursor.get();
> >                  Entry entry = se.getEntry();
> >                  System.out.println("sn: " +
> entry.get("sn").getString());
> >
> >          }
> >      }
>
> First, which version of the API are you using ?
>
>
> Then, can you provide the result you get ?
>
>
> Last, not least, are you sure your OpenLDAP server has the slapo-sssvlv
> overlay installed ?
>
> If so, can you provide its configuration ?
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message