Search code examples
javasortingpaginationldapunboundid-ldap-sdk

unboundid VirtualListViewRequestControl is not working


I would like to search with sorted order in pagination. For same I am using VirtualListViewRequestControl. Seem like it is not working I tried all possible way. But still I am getting following error :-

INFO: level="INFO" threadID=37 threadName="Connection reader for connection 8 to 10.96.186.240:389" revision=15579 connectionID=8 connectedTo="10.96.186.240:389" readLDAPResult="SearchResult(resultCode=76 (virtual list view error), messageID=6, diagnosticMessage='00002040: SvcErr: DSID-031401ED, problem 5010 (UNAVAIL_EXTENSION), data 0 ’, entriesReturned=-1, referencesReturned=-1, responseControls={VirtualListViewResponseControl(targetPosition=0, contentCount=0, resultCode=60 (sort control missing))})"

Even before adding VirtualListViewRequestControl in search request I am specifically checking that is my Directory supporting virturalListViewControl or not with help RootDSE, the result is yes. Same example I tried with jndi which is working fine. In documentation unboundid say that They support it but seem like it is not working.

Here is some sample code

SearchRequest searchRequest = new SearchRequest("dc=mydomain,dc=com",
          SearchScope.SUB, Filter.createEqualityFilter("objectClass", "person"));

searchRequest.setControls(
            new ServerSideSortRequestControl(false, new SortKey("sn"),
                 new SortKey("givenName")),
            new VirtualListViewRequestControl(vlvOffset, 0, 9, vlvContentCount,
                 vlvContextID, true));

SearchResult searchResult = connection.search(searchRequest);

Can somebody help me solving this issues. Or please redirect me where I can find solution.


Solution

  • "Note that Active Directory supports only a single sort key."

    ie (new ServerSideSortRequestControl(false, new SortKey("sn"), new SortKey("givenName")),

    Can only have one SortKey. -jim