驱动API搜索结果 [英] Drive API Search Results

查看:158
本文介绍了驱动API搜索结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用python的驱动器api。我们有这个功能,用户可以在驱动器内搜索文件。我们为api使用了以下参数。 maxResults = 20和q

  q ='mimeType!=application / vnd.google-apps.folder和fullText包含 %s'

查询返回3页。 Page 1 - 20结果,第2页 - 10结果,第3 - 4页结果。

这真的是api的行为吗?或者每页可能有相同的结果?



谢谢。

>

不幸的是,api自数年前就已经表现出色。

api之前使用了一些过滤器(使用它们的索引和尊重页面大小)和(20个元素页面)。



我甚至发现页面为空的情况,但仍然有一个如果你想向用户显示实际的分页,或者你有时间限制,有时你需要为了获得一些项目而得到很多页面,这使得查询非常无用。


Im using the drive api for python. We have this feature wherein the user is allowed to search for files inside the drive. We used the following parameters for the api. maxResults = 20 and q

        q = 'mimeType!="application/vnd.google-apps.folder" and fullText contains "%s" '

The query returned 3 pages. Page 1 - 20 results, Page 2 - 10 results, Page 3 - 4 results.

Is it really the behavior of the api? Or is it possible to have equal results per page?

Thank you.

解决方案

that has been, unfortunately, how the api has behaved since years ago.

the api applies some filters before (using their indexes and respecting page size) and some others (not supported by their indexes) after it has gotten results (the 20 elements page).

Ive even seen cases where the page is empty but still has a "next page" you need to keep getting.

Its a pain if you want to show an actual pagination to the user, or if you have time constrains as sometimes you need to get many pages just to get a few items, making the query very inneficient.

这篇关于驱动API搜索结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆