ldapopenldapldap-query

How to only get a slice of the results of a LDAP query?


Given a LDAP query, is there a generic way to get a slice of the query results? For instance if I just want the items 5000 to 5999 of the query and I am just not interested in reading the first 4999 ones.

I suppose this could be achieved by incrementing numeric attributes like inetOrgPerson employeeNumber but I am looking for a generic solution.

I expect that this is not possible, but I could not see a clear answer to that question anywhere.


Solution

  • For OpenLDAP at least, there is the combination of RFC2891 Server Side Sorting of Search Results (SSS) and the Scrolling View Browsing of Search Results (VLV) draft, often referred to as SSSVLV.

    The overlay can be loaded and configured with:

    dn: cn=module,cn=config
    cn: module
    objectClass: olcModuleList
    olcModuleLoad: sssvlv
    
    dn: olcOverlay=sssvlv,olcDatabase={1}mdb,cn=config
    objectClass: olcSssVlvConfig
    olcOverlay: sssvlv
    olcSssVlvMax: 1
    olcSssVlvMaxKeys: 5
    olcSssVlvMaxPerConn: 5
    

    On the client side, this is supported a least by: