【发布时间】:2024-01-21 01:17:01
【问题描述】:
我无法使用 Zend_Gdata_Calendar 返回具有完全匹配词组的 Google 日历事件子集。
setQuery() 部分中的 reference guide for Zend_Gdata_Books 表明 Zend 应该可以做到这一点:
请注意,参数值中的任何空格、引号或其他标点符号都必须进行 URL 转义(使用加号 (+) 表示空格)。要搜索确切的短语,请将短语括在引号中。例如,要搜索匹配短语“间谍飞机”的书籍,请将
q参数设置为%22spy+plane%22。
据我所知,Zend_Gdata_Books 和 Zend_Gdata_Calendar 扩展了相同的 setQuery() 函数,所以我认为它们在 Zend 端是等价的。
对于 Google,Calendar query parameters reference 表示日历 API 支持标准数据 API 查询参数,这反过来又表示全文查询字符串 q 支持不区分大小写的精确短语搜索,正如 Zend_Gdata_Books 所表明的那样.
这些方法我都试过了:
$gCal = new Zend_Gdata_Calendar();
$query = $gCal->newEventQuery();
$query->setQuery("%22event+text%22"); //no results
$query->setQuery("%22event%20text%22"); //no results
$query->setQuery("\"event text\""); //too many results
$query->setQuery('"event text"'); //too many results
$query->setQuery("event text"); //too many results
我意识到前两个不起作用,因为字符串被双重 URL 编码。在后一种情况下,我得到了我想要的事件,但也得到了我不想要的事件,包括“事件”或“文本”。
会不会是 Google 为 Calendar API 实现了不同的全文查询?我可能会做哪些愚蠢的事情来打破它?
【问题讨论】:
标签: php zend-framework google-calendar-api google-data-api zend-gdata