我正在使用来自此站点的 LDAP SDK:https://www.unboundid.com/products/ldap-sdk/ .我想做一个返回很多条目的搜索操作.
I am using the LDAP SDK from this site: https://www.unboundid.com/products/ldap-sdk/ . I would like to make a search operation which returns a lot of entries.
根据常见问题解答网站,(https://www.unboundid.com/products/ldap-sdk/docs/ldapsdk-faq.php#search )我必须使用 SearchResultListener 实现.
According to the FAQ's site, ( https://www.unboundid.com/products/ldap-sdk/docs/ldapsdk-faq.php#search ) I have to use a SearchResultListener implementation.
这就是我所做的:
public class UpdateThread extends Thread implements SearchResultListener {
...
// create request
final SearchRequest request = new SearchRequest(this, instance.getBaseDN(),SearchScope.SUB, filter);
// Setting size limit of results.
request.setSizeLimit(2000);
...
// Get every result one by one.
@Override
public void searchEntryReturned(SearchResultEntry arg0) {
System.out.println("entry "+arg0.getDN());
}
问题是searchEntryReturned"最多返回 1000 个结果.即使我将大小限制设置为2000".
The problem is that "searchEntryReturned" returns a maximum of 1000 results. Even if I set the size limit to "2000".
虽然几乎可以肯定服务器强制执行 1000 个条目的大小限制,但有可能通过分多个部分发出请求来解决这个问题.
Although it's almost certainly the case that the server is enforcing the size limit of 1000 entries, there are potentially ways to get around that by issuing the request in multiple parts.
如果服务器支持使用简单的分页结果控件(如 RFC 2696 中定义并在 LDAP SDK 中支持,根据 https://docs.ldap.com/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/controls/SimplePagedResultsControl.html),那么您可以使用它来遍历包含指定数量条目的页面"中的结果.
If the server supports the use of the simple paged results control (as defined in RFC 2696 and supported in the LDAP SDK as per https://docs.ldap.com/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/controls/SimplePagedResultsControl.html), then you can use it to iterate through the results in "pages" containing a specified number of entries.
或者,虚拟列表视图 (VLV) 请求控制 (https://www.unboundid.com/products/ldap-sdk/docs/javadoc/index.html?com/unboundid/ldap/sdk/controls/VirtualListViewRequestControl.html) 可以使用,但我可能只建议如果服务器不支持简单的分页结果控件,因为 VLV 请求控件还要求对结果进行排序,并且这可能需要特殊配置服务器或一些非常昂贵的处理,以便能够为请求提供服务.
Alternately, the virtual list view (VLV) request control (https://www.unboundid.com/products/ldap-sdk/docs/javadoc/index.html?com/unboundid/ldap/sdk/controls/VirtualListViewRequestControl.html) could be used, but I would probably only recommend that if the server doesn't support the simple paged results control because the VLV request control also requires that the results be sorted, and that likely either requires special configuration in the server or some pretty expensive processing in order to be able to service the request.
这篇关于LDAP:如何返回超过 1000 个结果(java)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!