【发布时间】:2015-09-13 06:15:31
【问题描述】:
我的 LDAP 的人员条目超过 100,000,但是当我输入搜索查询时,我只 收到 2000 个条目。
SearchControls constraints = new SearchControls();
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
constraints.setCountLimit(1);//pageSize
NamingEnumeration<SearchResult> results = ctx.search("DC=YourDomain,DC=com", filterQuery, constraints);
while (results != null && results.hasMore()) {
person = new Person();
Attributes attrs = ((SearchResult) results.next()).getAttributes();
person.setEmail(attrs.get("email").toString());
person.setEmployee_id(attrs.get("employee_id").toString());
person.setGuid(attrs.get("guid").toString());
person.setId(Integer.parseInt(attrs.get("id").toString()));
person.setName(attrs.get("name").toString());
person.setPhone(attrs.get("phone").toString());
person.setPpid(attrs.get("ppid").toString());
result.add(person);
}
抛出异常 -
javax.naming.SizeLimitExceededException: [LDAP: error code 4 - Sizelimit Exceeded];
【问题讨论】:
-
results在您测试它时不可能为空。