Hi,
I'm trying to use the range attribute.
For testing, I use a search that without range return 3 entries, and I set the range to 0-1, which should return only the first 2. However, I get all 3 results.
This is how I do it:
String rangeStr = attribute + ";range=0-1";
String returnedAttrs[] = {rangeStr, attribute};
_searchControls.setReturningAttributes(returnedAttrs);
_searchControls.setSearchScope(scope);
NamingEnumeration<SearchResult> answer = _context.search(name, filter, _searchControls);
List<String> result = new LinkedList<String>();
while (answer != null && answer.hasMoreElements())
{
Attribute currentAttr = answer.next().getAttributes().get(attribute);
if (currentAttr == null)
continue;
for (int i=0; i<currentAttr.size(); i++)
{
String val = currentAttr.get(i).toString();
result.add(val);
}
}
What am I doing wrong?
I use page size of 1000, but if I understand correctly, that is not supposed to influence the ranged search (given that the page size is larger than the requested range). Is that correct?