Google drive api 如何查找在可索引文本中包含撇号的文档

Google drive api 如何查找在可索引文本中包含撇号的文档,google-drive-api,Google Drive Api,我使用这一行来构建驱动器查询 request.setQ("fullText contains '" + originalFileName + "'"); 但是,当originalFilename包含“'”时,请求会引发以下错误: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "errors" : [ { "domain" : "

我使用这一行来构建驱动器查询

request.setQ("fullText contains '" + originalFileName + "'");
但是,当originalFilename包含“'”时,请求会引发以下错误:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request {   "code" : 400,   "errors" : [ {
    "domain" : "global",
    "location" : "q",
    "locationType" : "parameter",
    "message" : "Invalid Value",
    "reason" : "invalid"   } ],   "message" : "Invalid Value" }

我理解抛出错误的原因,但如何构建搜索字符串以查找可索引文本中包含“faq”的文件?是否有通配符或转义符?

您应该使用
\
转义
,因此:

"fullText contains \'myFile\'"

这应该被记录下来@大卫:文件也在这里,这个答案是误导性的。根据上面的文档,
在要搜索的字符串周围包含
requires/expected
。所以你不应该逃避周围的
。以常见问题为例,正确转义的查询看起来像
“全文包含‘常见问题’”