使用 google 驱动器 api 的全文字段

Using the fullText field with google drive api

我 运行 遇到 google 驱动器 API 的问题。 我用 composer 下载了这个库,它安装正确并且似乎可以工作。当我尝试在文件标题或 mimtypes 上搜索我的驱动器时它工作得很好但是当我想使用 fullText 字段时它失败并出现以下错误

Fatal error: Uncaught exception 'Google_Service_Exception' with message 'Error calling GET https://www.googleapis.com/drive/v2/files?q=fullText%3D%27Werken+met+procestaken+op+een+klant+project%27: (400) Invalid query'

我的代码

function searchFile($query,$service){
    $pageToken = null;
    do {
        $response = $service->files->listFiles(array(
            'q' => "fullText='".$query."'",
        ));
        foreach ($response->items as $file) {
            printf("Bestand gevonden: %s (%s)\n", $file->title, $file->id);
        }
    } while ($pageToken != null);
}

我做错了。这是它应该如何工作的。说不定对以后的人有帮助。

function searchFile($query,$service){
    $pageToken = null;
    do {
        $response = $service->files->listFiles(array(
          'corpus' => 'DEFAULT',
          'q' => "fullText contains '".$query."'",
         ));

    foreach ($response->items as $file) {
        printf("Bestand gevonden: %s (%s)\n", $file->title, $file->id);
    }
  } while ($pageToken != null);
}