Google Custom Search Engine API - lowRange, highRange, startNum

In line #2, with parameter "highRange":"19800","inputEncoding":"utf8","lowRange":"19700" get total 3 search results with the custom engine.

But in line #50, with parameter "highRange":"19900","inputEncoding":"utf8","lowRange":"19800" get total 0 search results....

And again in line #103, with parameter "highRange":"20000","inputEncoding":"utf8","lowRange":"19900" get total 4840 results...



What is the lowRange and highRange exactly???

highRangestring
  • Specifies the ending value for a search range.
  • Use lowRange and highRange to append an inclusive search range of lowRange...highRange  to the query.
One  of the most relevant answer in Google group is: 

-------------------------------
In my opinion you could get all the results using the lowRange and High Range properties of the query, and putting values higher than 100
I am using the .net interface and it would look like that:

 CustomsearchService svc = new CustomsearchService();
                    svc.Key = apiKey;
                    
                    Google.Apis.Customsearch.v1.CseResource.ListRequest listRequest = svc.Cse.List(query);
                    listRequest.Cx = cx;
                    
                    listRequest.Start = 0; 
                    listRequest.Num = 10; 
                    listRequest.LowRange = "100";
                    listRequest.HighRange = "200";
                    Google.Apis.Customsearch.v1.Data.Search search = listRequest.Fetch();

                    foreach (Google.Apis.Customsearch.v1.Data.Result result in search.Items)
                    {
                        Console.WriteLine("Title: {0}", result.Title);
                        Console.WriteLine("Link: {0}", result.Link);
                    }
----------------------------------------


But it doesn't make sense in this experiments.... or maybe due to the different search engine mirror used in my case...

1:  results searchinfo:{"formattedSearchTime":"0.41","formattedTotalResults":"3","searchTime":0.409284,"totalResults":"3"}  
2:  results getQuery:{request=[{"count":3,"cx":"008378975908491122506:kjiqkuune8u","highRange":"19800","inputEncoding":"utf8","lowRange":"19700","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":1,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"3"}]}  
3:  result size3  
4:  Nick Hall | <b>LinkedIn</b>  
5:  https://www.linkedin.com/in/cloggin  
6:  -----------------------  
7:  Ben Cairns - MEng | <b>LinkedIn</b>  
8:  www.linkedin.com/in/bencairns  
9:  -----------------------  
10:  Sirron Carrector | <b>LinkedIn</b>  
11:  https://www.linkedin.com/in/sirroncarrector  
12:  -----------------------  
13:  starting from...1  
14:  Dec 01, 2014 3:19:03 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
15:  WARNING: Application name is not set. Call Builder#setApplicationName.  
16:  results searchinfo:{"formattedSearchTime":"0.50","formattedTotalResults":"0","searchTime":0.502496,"totalResults":"0"}  
17:  Dec 01, 2014 3:19:04 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
18:  WARNING: Application name is not set. Call Builder#setApplicationName.  
19:  results getQuery:{request=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"19900","inputEncoding":"utf8","lowRange":"19800","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":1,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"0"}]}  
20:  starting from...11  
21:  results searchinfo:{"formattedSearchTime":"0.51","formattedTotalResults":"0","searchTime":0.509313,"totalResults":"0"}  
22:  results getQuery:{request=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"19900","inputEncoding":"utf8","lowRange":"19800","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":11,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"0"}]}  
23:  starting from...21  
24:  Dec 01, 2014 3:19:05 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
25:  WARNING: Application name is not set. Call Builder#setApplicationName.  
26:  com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Internal Server Error  
27:  {  
28:   "code" : 500,  
29:   "errors" : [ {  
30:    "domain" : "global",  
31:    "message" : "Backend Error",  
32:    "reason" : "backendError"  
33:   } ],  
34:   "message" : "Backend Error"  
35:  }  
36:  starting from...31  
37:       at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)  
38:       at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)  
39:       at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)  
40:       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)  
41:       at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1049)  
42:       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)  
43:       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)  
44:       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)  
45:       at parklize.blogspot.com.test.GoogleSearchClient.getSearchResult(GoogleSearchClient.java:55)  
46:       at parklize.blogspot.com.test.GoogleSearchClient.main(GoogleSearchClient.java:101)  
47:  Dec 01, 2014 3:19:10 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
48:  WARNING: Application name is not set. Call Builder#setApplicationName.  
49:  results searchinfo:{"formattedSearchTime":"4.87","formattedTotalResults":"0","searchTime":4.868337,"totalResults":"0"}  
50:  results getQuery:{request=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"19900","inputEncoding":"utf8","lowRange":"19800","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":31,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"0"}]}  
51:  starting from...41  
52:  Dec 01, 2014 3:19:15 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
53:  WARNING: Application name is not set. Call Builder#setApplicationName.  
54:  results searchinfo:{"formattedSearchTime":"0.65","formattedTotalResults":"0","searchTime":0.645973,"totalResults":"0"}  
55:  Dec 01, 2014 3:19:16 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
56:  WARNING: Application name is not set. Call Builder#setApplicationName.  
57:  results getQuery:{request=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"19900","inputEncoding":"utf8","lowRange":"19800","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":41,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"0"}]}  
58:  starting from...51  
59:  results searchinfo:{"formattedSearchTime":"0.70","formattedTotalResults":"0","searchTime":0.704197,"totalResults":"0"}  
60:  Dec 01, 2014 3:19:18 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
61:  WARNING: Application name is not set. Call Builder#setApplicationName.  
62:  results getQuery:{request=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"19900","inputEncoding":"utf8","lowRange":"19800","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":51,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"0"}]}  
63:  starting from...61  
64:  com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Internal Server Error  
65:  {  
66:   "code" : 500,  
67:   "errors" : [ {  
68:    "domain" : "global",  
69:    "message" : "Backend Error",  
70:    "reason" : "backendError"  
71:   } ],  
72:   "message" : "Backend Error"  
73:  }  
74:  starting from...71  
75:       at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)  
76:       at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)  
77:       at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)  
78:       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)  
79:       at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1049)  
80:       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)  
81:       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)  
82:       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)  
83:       at parklize.blogspot.com.test.GoogleSearchClient.getSearchResult(GoogleSearchClient.java:55)  
84:       at parklize.blogspot.com.test.GoogleSearchClient.main(GoogleSearchClient.java:101)  
85:  Dec 01, 2014 3:19:23 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
86:  WARNING: Application name is not set. Call Builder#setApplicationName.  
87:  results searchinfo:{"formattedSearchTime":"3.40","formattedTotalResults":"0","searchTime":3.402622,"totalResults":"0"}  
88:  results getQuery:{request=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"19900","inputEncoding":"utf8","lowRange":"19800","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":71,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"0"}]}  
89:  starting from...81  
90:  Dec 01, 2014 3:19:27 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
91:  WARNING: Application name is not set. Call Builder#setApplicationName.  
92:  results searchinfo:{"formattedSearchTime":"0.72","formattedTotalResults":"0","searchTime":0.722594,"totalResults":"0"}  
93:  results getQuery:{request=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"19900","inputEncoding":"utf8","lowRange":"19800","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":81,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"0"}]}  
94:  starting from...91  
95:  Dec 01, 2014 3:19:28 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
96:  WARNING: Application name is not set. Call Builder#setApplicationName.  
97:  results searchinfo:{"formattedSearchTime":"0.56","formattedTotalResults":"0","searchTime":0.558098,"totalResults":"0"}  
98:  results getQuery:{request=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"19900","inputEncoding":"utf8","lowRange":"19800","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":91,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"0"}]}  
99:  starting from...1  
100:  Dec 01, 2014 3:19:28 PM com.google.api.client.googleapis.services.AbstractGoogleClient <init>  
101:  WARNING: Application name is not set. Call Builder#setApplicationName.  
102:  results searchinfo:{"formattedSearchTime":"0.34","formattedTotalResults":"4,840","searchTime":0.336376,"totalResults":"4840"}  
103:  results getQuery:{nextPage=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"20000","inputEncoding":"utf8","lowRange":"19900","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":11,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"4840"}], request=[{"count":10,"cx":"008378975908491122506:kjiqkuune8u","highRange":"20000","inputEncoding":"utf8","lowRange":"19900","outputEncoding":"utf8","safe":"off","searchTerms":"linkedin.com/in coursera","siteSearch":"http://www.linkedin.com/in/","startIndex":1,"title":"Google Custom Search - linkedin.com/in coursera","totalResults":"4840"}]}  
104:  result size10  

No comments:

Post a Comment