我正在使用Google自定义搜索API搜索图像.我的实现使用Java,这就是我构建搜索字符串的方式:
I am using the Google Custom Search API to search for images. My implementation is using Java, and this is how I build my search string:
URL url = new URL("ajax.googleapis/ajax/services/search/images?" + "v=1.0&q=barack%20obama&userip=INSERT-USER-IP");我将如何修改URL以将搜索结果限制为例如2014-08-15和2014-09-31?
How would I modify the URL to limit search results, for example, to: 2014-08-15 and 2014-09-31?
推荐答案您可以使用sort参数指定日期范围.对于您的示例,您可以将其添加到查询字符串:sort=date:r:20140815:20140931.
You can specify a date range using the sort parameter. For your example, you would add this to your query string: sort=date:r:20140815:20140931.
此文档记录在 developers.google/custom-搜索/docs/structured_data#page_dates
此外,如果您使用Google的Java API,则可以使用Query类及其setSort()方法,而不是手动构建URL.
Also if you use Google's Java API you can use the Query class and its setSort() method rather than building the URL by hand.
更多推荐
使用Google自定义搜索API进行日期范围搜索
发布评论