在Google自定义搜索API中,对于searchType=image;权利”;领域


In Google Custom Search API for searchType=image what is the expected value for the "rights" field?

我正在使用PHP sdk进行图像搜索

$service = new Google_Service_Customsearch($client);
$optParams = array(
        'imgType' => 'photo',
        'imgColorType' => 'color',
        'imgSize' => 'large',
        'searchType' => 'image',
        'num' => '5',
        'safe' => 'medium',
        'rights' => '(cc_publicdomain|cc_attribute|cc_sharealike)',
        'filter' => '1',
        'cx' => <my cx>,
        );
$results = $service->cse->listCse($query, $optParams);

但我不清楚"权利"领域是否在做任何事情。

它似乎生成了一个卷曲请求,看起来像这样。。。

https://www.googleapis.com/customsearch/v1?       
q=<query here>
&imgType=photo
&imgColorType=color
&imgSize=large
&searchType=image
&num=6
&safe=medium
&rights=%28cc_publicdomain%7Ccc_attribute%7Ccc_sharealike%29
&filter=1
&cx=<my cx>

但我不清楚这是否符合我的预期。当我使用web表单时,我的查询返回不同的图像。

此外,文档中还对。。

rights  | string    | Filters based on licensing. Supported values include:
        |           | cc_publicdomain, cc_attribute, cc_sharealike, cc_noncommercial,
        |           | cc_nonderived, and combinations of these.

然而,我从来没有得到一个错误与这个领域,我可以把任何垃圾我想放进去。

谷歌期望的正确格式是什么?逗号分隔?大堆管道?

此外,文档中列出的选项似乎与web表单中的选项不完全匹配,那里的一些见解也很好。

您可以在此处查看自定义搜索的许可证

https://developers.google.com/custom-search/docs/structured_search#licensing