You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Drive API:使用'in parents'选项时全文搜索失效问题

Google Drive API 全文搜索搭配'in parents'查询异常问题

在使用Google Drive API检索Google Docs文件时,遇到了一个奇怪的异常:当全文搜索条件与in parents条件组合时,查询返回空结果,但单独使用全文搜索能找到目标文件,且该文件确实属于指定的父文件夹(ID为1234567)。

异常查询及结果

执行以下查询:

fullText contains 'часом знемагаю' and trashed = false and mimeType = 'application/vnd.google-apps.document' and '1234567' in parents

返回空文件列表:

{
    "files": []
}

移除父文件夹条件后的正常结果

去掉'1234567' in parents部分后,查询能正确返回目标文件,且文件的parents字段明确包含1234567:

fullText contains 'часом знемагаю' and trashed = false and mimeType = 'application/vnd.google-apps.document'

返回结果:

{
    "files": [
        {
            "parents": [
                 "1234567"
            ]
        }
    ]
}

几个特殊的有效场景

  • 如果全文搜索的关键词是文件名中的内容,带in parents的查询可以正常返回结果;
  • 把in parents条件重复一次(用or连接),查询也能正常生效:
fullText contains 'часом знемагаю' and trashed = false and mimeType = 'application/vnd.google-apps.document' and ('1234567' in parents or '1234567' in parents)

临时解决办法

目前可以采用重复in parents条件的方式绕过这个问题,确保查询能命中目标文件。

推测原因

这个问题很可能是Google Drive API的查询引擎或索引逻辑出现了临时bug,因为该查询之前是可以正常工作的,且特殊场景下的表现明显不符合预期。建议后续留意Google Workspace开发者官方的相关修复通知。

内容的提问来源于stack exchange,提问作者joeyave

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 08:12:45