我正在使用Google Drive搜索API与Files.list - search for files。
我的查询类似于:fullText contains 'battle of hastings'
。
我得到的结果似乎表明它会搜索单个单词,而不是整个短语。我并不完全清楚,并且将API的功能与通过网站在Google搜索上可以完成的功能联系起来,所以请在那里纠正我。
无论如何,我真的只想要整个短语的结果 - 比如在Google的搜索网站中用双引号括起一个短语。例如,如果您使用Google的搜索网站搜索"no one will have written this before"
,则会显示'No results found for "no one will have written this before".'
,但如果您不使用双引号,那么您将获得所有类型的东西。
总结:
答案 0 :(得分:0)
使用Files:List的try部分并查阅search parameter文档。
fullText - Full text of the file including title, description, and content.
contains - The content of one string is present in the other.
我使用此测试
fullText contains 'daimto twitter'
它返回了包含该完全匹配的所有文件。
答案 1 :(得分:0)
通过使用try it工具,我发现该行为类似于google驱动器中的搜索ui,并且您需要将带有双引号的短语包围起来。引号应该编码到URL中,如下所示:
https://www.googleapis.com/drive/v2/files?maxResults=100&
q=fullText+contains+'%22flippity+floppity%22'
我不确定空间是否需要像这样编码,但我试图尽可能地模拟它。