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 ?