03-23-2012 08:44 AM
What is the meaning of pageSize attribute when doing user search request?
I could not find any description of its meaning in documentation.
With prior versions of BAS, I was able to pull all users with such a request in
Java, but now they are limited to some 500 users/accounts only.
I am now dealing with the following environment:
-BES 5.0.3 MR6 (22.214.171.124)
-running on Win 2003 SP2 (Windows/2003 5.2 Intel) on Domino Release 8.5.2FP2 HF148.
-DB SQL Server instances on 64 bit SQL 2008R2 (10.50.2500.0)
Here is the Java code that worked in the past and now is misbehaving:
GetUsersRequest request = newGetUsersRequest();
GetUsersSearchCriteria searchCriteria =newGetUsersSearchCriteria();
GetUsersSortBy sortBy =newGetUsersSortBy();
GetUsersResponse response =_bws.getUsers(request);
Solved! Go to Solution.
03-23-2012 03:19 PM
pageSize refers to the number of results to return at once. This way the BAS can send results in chunks. For efficiency you likely want to keep this between 200-500. The sample code for BWS#getUsers() shows how this is used. One big chunk can be error prone and slow, sometimes even unnescessary depending on how much info you need to display.
03-24-2012 03:27 AM
thank you for the reply.
the question now is how do I process page after page until all results are actually grabbed. this would be viable alternative to setting the pageSize to a very large, all-encompassing number to get all results (found records?) in one 'page'. sample code, perhaps, or a reference to documentation?
second question: if I wanted to do the latter, what number should I set the pageSize to? would, for example, setting it to 0 return result in all records being pulled/returned?
these are the kind of questions that well written BES API documentation would/should solve...
thanks again for all the input!
03-26-2012 09:20 AM
For your first question I would refer you again to BWS#getUsers() in the API documentation which shows how to retrieve all pages of results.
It is not recommended to try to retrieve all results at once for efficiency sake. For example: say you are receiving 10,000 results from the BAS and a failure occurs with the data transmission, you would then need to re-request all 10,000 records. Instead, splitting these up to 200-500 results per page means that if a failure occurs you only need to re-request 200-500 records.
As well, limiting the page request allows you to display information to the user much faster.
03-26-2012 09:29 AM
regrettably I can't find the information that I am being referred to for the 2nd time. would it not be more productive and user friendly, if link to such information be provided here? I have been hunting the docs for the info and was unable to do so. that is why I came to this and other support locations to actually receive help.
03-26-2012 09:32 AM
Sorry, it's in the API documentation located in the standard BWS documentation section:
If you still have difficulties finding the referenced call please let me know.
03-26-2012 09:56 AM
no problem, it can get frustrating now and then
I am unable to find the info still for both most recent questions:
1. if I set the pageSize for 200-500 records, what is the API call to get the next page (i.e. ?getNextPage?) of search results for processing and what is the API flag that says that there is no more pages to process (i.e. ?isLastPage?)? this would be my preferred approach, but I can't find in the docs description of such APIs (even if starting from pageSize), as well as examples that use them.
2. in my case, retrieving all the results in 'one shot' does not create performance problems, as it is done
only once, at a setup time, and at that time there is no need to display search results to any users. is there a way to setup pageSize to mean 'all records available no matter how many records there may be now or in the future'? or do I need to just provide an estimated number, as parameter, and then revisit the code when such threshold is reached?
03-26-2012 10:01 AM
For #1 you pass the page number as a parameter then check the results to see if they are less than the page size, if the returned results are less than the page size then you are at the end. This functionality is shown in the code sample for getUsers():
#2, this is described in the parameters section of the getUsers call:
pageSize - number of users to return on the current page. A page size less than or equal to zero will return all of the remaining users on a single page.