How to count the number of entries matched by a LD

2019-07-15 11:11发布

问题:

How to count the number of entries matched by a LDAP query without retrieving the records?

I am trying several different LDAP filters on a big set of entries and for performance reasons I want to know only the number of returned entries, not to get them all.

Is this possible, how?

回答1:

No. The LDAP protocol does not provide support for counting. A server implementation could provide this information via an supportedControl or supportedExtension or some other "Feature", but I do not know of any that do this.

UnboundID's SDK can perform the search and provide a searchResult count, but the search has to be completed before the count is complete. This would only save you the iteration of the results to perform the counting.