Why has google decided to ignore pageSize
parameter and why the overall size of the collected items differs when using different page size? Here is an example:
Appsactivity.Activities.List request = service.activities().list()
.setDriveAncestorId(ancestorId)
.setGroupingStrategy("driveUi")
.setSource("drive.google.com")
.setUserId("me")
.setPageSize(pageSize);
List<Activity> list = new LinkedList<>();
ListActivitiesResponse response = null;
do {
response = request.execute();
List<Activity> fetched = response.getActivities();
System.out.println("page items: " + fetched.size());
list.addAll(fetched);
request.setPageToken(response.getNextPageToken());
} while (request.getPageToken() != null && request.getPageToken().length() > 0);
System.out.println("all items: " + list.size())
When I set pageSize
to 100, I will get 720 items (64, 71, 60, 60, 76, 92, 87, 74, 62, 56, 18), however when I set pageSize
to 5 the result set contains 810 items. Am I missing something or it's an API bug?
EDIT
I've just checked singleEvents counts by using event time as key. Few events were duplicated, however the significant difference between events count is still present, when using different pageSize.
Another question like this google-api-java-client-pagesize
It seems that it is a bug according to the following links:
Result set can probably contain duplicates in some cases is-paging-broken-in-drive
The following link contains explanation of the page size oscilation. drive-api-search-results