App Engine Java API pageSize

China☆狼群 提交于 2019-12-13 13:27:19

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/34846688/app-engine-java-api-pagesize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!