简体   繁体   English

如何从Google Custom Search API获得100多个结果

[英]How to get more than 100 results from Google Custom Search API

I am trying to use Google Custom Search API for research purposes in Java. 我正在尝试将Google Custom Search API用于Java中的研究目的。 As a result I'm gonna need a big result set for each query. 因此,我需要为每个查询设置一个大的结果集。 However it seems that I'm limited with first 100 results which is much less than what I need. 然而,似乎我受限于前100个结果,远远低于我的需要。 I use the list method like this: 我使用这样的list方法:

list.setStart(90L);

And when I set it to start from index 100 I get this error: 当我将其设置为从索引100开始时,我收到此错误:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request

{   "code" : 400,   
    "errors" : [ {
    "domain" : "global",
    "message" : "Invalid Value",
    "reason" : "invalid"   
  } ],   
    "message" : "Invalid Value" 
}

Is there any way to remove this limitation? 有没有办法消除这个限制?

There's a difference between two limitations: a) max 100 queries per day; 两个限制之间存在差异:a)每天最多100个查询; and b) max 100 results per searched phrase (even split into 10 queries of 10 results per query). b)每个搜索短语最多100个结果(甚至分成10个查询,每个查询10个结果)。 The limitation (a) can be solved by paying to Google, whereas limitation (b) cannot be solved at all, it seems to be a feature of the CSE product when searching the whole web (ie not just a site search, which can give more results), see eg https://productforums.google.com/forum/#!topic/customsearch/VM8_6trCxGU 限制(a)可以通过支付给谷歌来解决,而限制(b)根本无法解决,它似乎是搜索整个网络时CSE产品的一个特征(即不仅仅是网站搜索,它可以给予更多结果),请参阅https://productforums.google.com/forum/#!topic/customsearch/VM8_6trCxGU

You can only request 10 results per query with Google Custom Search, so you'd want to split up that search into multiple queries. 您只能使用Google自定义搜索为每个查询请求10个结果,因此您需要将该搜索拆分为多个查询。 (I don't know how your actual query code works so I don't know if you already know this) (我不知道你的实际查询代码是如何工作的,所以我不知道你是否已经知道这个)

Google Custom Search (Free) also has a limit of 100 queries per day, so if you want more, you'd have to pay. Google自定义搜索(免费)每天最多只能有100个查询,因此如果您需要更多查询,则必须付费。

You can find the pricing here: https://developers.google.com/custom-search/json-api/v1/overview 您可以在此处找到定价: https//developers.google.com/custom-search/json-api/v1/overview

You can use lowRange and highRange to solve this problem. 您可以使用lowRange和highRange来解决此问题。 See: https://productforums.google.com/forum/#!topic/customsearch/2qilVDaCz0A 请参阅: https//productforums.google.com/forum/#!topic/customsearch/2qilVDaCz0A

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM