Menu

Paging search

gabriele
2012-11-13
2013-06-13
  • gabriele

    gabriele - 2012-11-13

    hi,
    I there any ways to  paging result in ldap search?
    thanks,

    gab

     
  • Neil Wilson

    Neil Wilson - 2012-11-13

    Yes, there are a couple of ways to accomplish this.  Which option you should choose depends on what your needs are and what is supported by the directory server you are using.

    - The simple paged results control is defined in RFC 2696, and it just allows you to page through results by retrieving no more than a specified number of entries at a time.  The UnboundID LDAP SDK for Java supports this control in the com.unboundid.ldap.sdk.controls.SimplePagedResultsControl class (https://www.unboundid.com/products/ldap-sdk/docs/javadoc/index.html?com/unboundid/ldap/sdk/controls/SimplePagedResultsControl.html), and the javadoc includes an example of how to use it.

    - The virtual list view (VLV) request control is defined in a long-expired IETF draft, but many servers support it.  It is more advanced than the simple paged results control because whereas simple paged results only allows you to iterate linearly through the results, VLV allows you to retrieve arbitrary pages of results, specifying the starting point either as a numeric offset or starting at a specified value.  VLV requires that the results be sorted (through the use of the server-side sort control), so it can also require more processing or special server configuration to handle efficiently.  The UnboundID LDAP SDK for Java supports this control in the com.unboundid.ldap.sdk.controls.VirtualListViewRequestControl class (https://www.unboundid.com/products/ldap-sdk/docs/javadoc/index.html?com/unboundid/ldap/sdk/controls/VirtualListViewRequestControl.html), and the javadoc includes an example of how to use it.

    You can determine whether your directory server supports either or both of these controls by looking at the supportedControl attribute of the server's root DSE.  If the attribute contains a value of "1.2.840.113556.1.4.319", then the server supports simple paged results.  If it has a value of "2.16.840.1.113730.3.4.9", then the server supports VLV.

    Neil

     
  • gabriele

    gabriele - 2012-11-14

    Great!
    Thanks for your reply Neil!

    G

     

Log in to post a comment.