6

I am trying to use Google Custom Search API for research purposes in 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. I use the list method like this:

list.setStart(90L);

And when I set it to start from index 100 I get this error:

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?

Mahdi
  • 61
  • 1
  • 2

3 Answers3

9

There's a difference between two limitations: a) max 100 queries per day; and b) max 100 results per searched phrase (even split into 10 queries of 10 results per query). 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 (i.e. not just a site search, which can give more results), see e.g. https://productforums.google.com/forum/#!topic/customsearch/VM8_6trCxGU

jrx1301
  • 133
  • 1
  • 7
0

You can only request 10 results per query with Google Custom Search, so you'd want to split up that search into multiple queries. (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.

You can find the pricing here: https://developers.google.com/custom-search/json-api/v1/overview

gegy1000
  • 137
  • 1
  • 10
  • 5
    Thanks. Yes I already know it. Problem is not the number of queries. As far as I understood, google just provides 10 results per query, so if I need more I have to repeat my query and change the starting index. BUT the limit for changing the starting index is 90. This means I cannot have more than 100 results per query. I wanna know is there any way to basically get limitless number of results. – Mahdi Dec 04 '15 at 09:04
-1

You can use lowRange and highRange to solve this problem. See: https://productforums.google.com/forum/#!topic/customsearch/2qilVDaCz0A

  • 1
    Please post the relevant code in your answer to add to the link you posted. https://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers – Blundering Philosopher Mar 29 '17 at 23:34
  • It's noted in that forum thread that this doesn't work. Just confirmed that myself. – alexbea Mar 22 '18 at 20:08