How to read all results from local search api

225 views
Skip to first unread message

Richardson

unread,
Sep 2, 2009, 9:04:52 AM9/2/09
to Google AJAX APIs
Hi,
function abc()
{
.......
searchControl.setSearchCompleteCallback(this, gotResults);
}

function gotResults(sc, searcher){
var restaurants = new Array();
for (i=0; i<searcher.results.length; i++){
.......
.......
}
}

From the above code I am able to get 4 results only. How to get all
reesults from Local search API.

Thanks in advance.

Regards,
Richrads...

Jeremy Geerdes

unread,
Sep 2, 2009, 9:49:42 AM9/2/09
to google-ajax...@googlegroups.com
You can currently get up to 32 results, 8 results at a time using the
JS API's gotoPage() method. For more information on using gotoPage,
check out the documentation at the link below:

http://code.google.com/apis/ajaxsearch/documentation/reference.html#_class_GSearch

If you want to get all of the results for simultaneous display, check
out my blog post at the link below. Make sure to check the comments,
as there is an important bug fix in there.

http://jgeerdes.blogspot.com/2008/12/how-to-get-all-results-available-from.html

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
jgee...@mchsi.com

Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!

Richardson

unread,
Sep 3, 2009, 2:18:15 AM9/3/09
to Google AJAX APIs
Hi Jeremy,

Thanks for the reply.

Now I am getting 32 results at most.

API is providing 'More Results' link in the search results. When I
clicked on that link; API is giving more results in a new browser. Is
there any API to read those results?

Regards,
Richrads...

On Sep 2, 6:49 pm, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> You can currently get up to 32 results, 8 results at a time using the  
> JS API's gotoPage() method. For more information on using gotoPage,  
> check out the documentation at the link below:
>
> http://code.google.com/apis/ajaxsearch/documentation/reference.html#_...
>
> If you want to get all of the results for simultaneous display, check  
> out my blog post at the link below. Make sure to check the comments,  
> as there is an important bug fix in there.
>
> http://jgeerdes.blogspot.com/2008/12/how-to-get-all-results-available...
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.comhttp://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com
> jgeer...@mchsi.com
>
> Unless otherwise noted, any price quotes contained within this  
> communication are given in US dollars.
>
> If you're in the Des Moines, IA, area, check out Debra Heights  
> Wesleyan Church!
>
> And check out my blog, Adventures in Web Development, athttp://jgeerdes.blogspot.com
>   !
>
> On Sep 2, 2009, at 8:04 AM, Richardson wrote:
>
>
>
>
>
> > Hi,
> > function abc()
> > {
> >  .......
> >  searchControl.setSearchCompleteCallback(this, gotResults);
> > }
>
> > function gotResults(sc, searcher){
> >   var restaurants = new Array();
> >   for (i=0; i<searcher.results.length; i++){
> >     .......
> >     .......
> >   }
> >  }
>
> > From the above code I am able to get 4 results only. How to get all
> > reesults from Local search API.
>
> > Thanks in advance.
>
> > Regards,
> > Richrads...- Hide quoted text -
>
> - Show quoted text -

Jeremy Geerdes

unread,
Sep 3, 2009, 6:18:49 AM9/3/09
to google-ajax...@googlegroups.com
No. As I said in my previous post, the LocalSearch portion of the API
will return only up to 32 results. There are no other legal options to
retrieve more results.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!


MarkOG

unread,
Sep 12, 2009, 7:46:28 AM9/12/09
to Google AJAX APIs
Hello,

Why is the following search returning "out of range start":
http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rsz=small&lr=lang_en&hl=en&start=26

There should be 6 more results to retrieve because the start is set to
26.
The result size is set to small so the query should return 4 results.
Numbers 26, 27, 28 and 29.

Regards,
Mark.




On Sep 3, 11:18 am, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> No. As I said in my previous post, the LocalSearch portion of the API  
> will return only up to 32results. There are no other legal options to  
> retrieve moreresults.
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.comhttp://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com
> jgeer...@mchsi.com
>
> Unless otherwise noted, any price quotes contained within this  
> communication are given in US dollars.
>
> If you're in the Des Moines, IA, area, check out Debra Heights  
> Wesleyan Church!
>
> And check out my blog, Adventures in Web Development, athttp://jgeerdes.blogspot.com
>   !
>
> On Sep 3, 2009, at 1:18 AM, Richardson wrote:
>
>
>
> > Hi Jeremy,
>
> > Thanks for the reply.
>
> > Now I am getting 32resultsat most.
>
> > API is providing 'MoreResults' link in thesearchresults. When I
> > clicked on that link; API is giving moreresultsin a new browser. Is
> > there any API to read thoseresults?
>
> > Regards,
> > Richrads...
>
> > On Sep 2, 6:49 pm, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> >> You can currently get up to 32results, 8resultsat a time using the
> >> JS API's gotoPage() method. For more information on using gotoPage,
> >> check out the documentation at the link below:
>
> >>http://code.google.com/apis/ajaxsearch/documentation/
> >> reference.html#_...
>
> >> If you want to get all of theresultsfor simultaneous display, check
> >>> From the above code I am able to get 4resultsonly. How to get all

Jeremy Geerdes

unread,
Sep 12, 2009, 11:01:35 AM9/12/09
to google-ajax...@googlegroups.com
The start parameter needs to be a multiple of 4. In other words, you
can start at 24 or 28, but not 26.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!


MarkOG

unread,
Sep 14, 2009, 5:50:39 AM9/14/09
to Google AJAX APIs
Hello Jeremy,

Thanks for your suggestion but I do not think that is correct.

Start Parameter can be anything. Try the 2 urls below. They return the
expected results.

http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rsz=small&lr=lang_en&hl=en&start=23

http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rsz=small&lr=lang_en&hl=en&start=24

The point I am making is that once you go over 24 there are no results
returned.

E.g. http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rsz=small&lr=lang_en&hl=en&start=28

There should be 4 results returned for the query starting at 28 but
there are none. Try the above url to prove it.

Regards,
Mark.






On Sep 12, 4:01 pm, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> The start parameter needs to be a multiple of 4. In other words, you  
> can start at 24 or 28, but not 26.
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.comhttp://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com
> jgeer...@mchsi.com
>
> Unless otherwise noted, any price quotes contained within this  
> communication are given in US dollars.
>
> If you're in the Des Moines, IA, area, check out Debra Heights  
> Wesleyan Church!
>
> And check out my blog, Adventures in Web Development, athttp://jgeerdes.blogspot.com
>   !
>
> On Sep 12, 2009, at 6:46 AM, MarkOG wrote:
>
>
>
> > Hello,
>
> > Why is the following search returning "out of range start":
> >http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rs...

Jeremy Geerdes

unread,
Sep 14, 2009, 7:21:18 AM9/14/09
to google-ajax...@googlegroups.com
Well, we were both right. After further testing, I've discovered that
you can provide start values that are not multiples of four, but they
don't always return different results. For instance, start values of
21 and 22 seem to return the same resultsets. In other words, there is
apparently some flexibility in that you can move 1 result in either
direction of a multiple of 4 and get results, but not 2.

However, there is also another limit at work here. The API is designed
to return either 4 results or 8. In either case, though, the
LocalSearch is designed to return only four different pages, for a
maximum result total of 32. Apparently, it assumes that if you're
going for 32 results, you're using the larger result set, and so it
does not accept start values greater than 32 - 8, or 24.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!


MarkOG

unread,
Sep 14, 2009, 8:13:06 AM9/14/09
to Google AJAX APIs
Start parameter of 21 AND 22 return different results. See below

http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rsz=small&lr=lang_en&hl=en&start=21
Results for start 21:

Item 1: M Automotive
Item 2: San Francisco Auto Sport
Item 3: Enterprise Rent-A-Car - SF-Mission St
Item 4: Tom See S

http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rsz=small&lr=lang_en&hl=en&start=22
Results for start 22:

Item 1: San Francisco Auto Sport
Item 2: Enterprise Rent-A-Car - SF-Mission St
Item 3: Tom See S
Item 4: KSH Automotive

When you compare the first set of results to the second set of results
you can see that the second search has removed the first item and
added a new item to the bottom of its results. This is the expected
and correct behaviour.

Therefore the start paramerter does seem to work correctly and return
different result sets.

Anyway forget about that for now.
I an not bothered exactly how the code works or why you can not get
the last 8 results.

My real gripe is:
I think that we should be able to retrieve the last 8 items out of the
possible 32 items, whether we are using a small result set or a large
result set.
Even when doing a web search (that returns 64 results) instead of a
local search, when requesting a small set of results, you are unable
to access the last 8 items.

If this behaviour is by design then is behaviour is a limitation and
should be documented in the Google AJAX Search API documentation.
E.g. Here http://code.google.com/apis/ajaxsearch/documentation/reference.html#_fonje_args

What do you think about my statement about documentation?


Regards,
Mark.




On Sep 14, 12:21 pm, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> Well, we were both right. After further testing, I've discovered that  
> you can provide start values that are not multiples of four, but they  
> don't always return different results. For instance, start values of  
> 21 and 22 seem to return the same resultsets. In other words, there is  
> apparently some flexibility in that you can move 1 result in either  
> direction of a multiple of 4 and get results, but not 2.
>
> However, there is also another limit at work here. The API is designed  
> to return either 4 results or 8. In either case, though, the  
> LocalSearch is designed to return only four different pages, for a  
> maximum result total of 32. Apparently, it assumes that if you're  
> going for 32 results, you're using the larger result set, and so it  
> does not accept start values greater than 32 - 8, or 24.
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.comhttp://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com
> jgeer...@mchsi.com
>
> Unless otherwise noted, any price quotes contained within this  
> communication are given in US dollars.
>
> If you're in the Des Moines, IA, area, check out Debra Heights  
> Wesleyan Church!
>
> And check out my blog, Adventures in Web Development, athttp://jgeerdes.blogspot.com
>   !
>
> On Sep 14, 2009, at 4:50 AM, MarkOG wrote:
>
>
>
> > Hello Jeremy,
>
> > Thanks for your suggestion but I do not think that is correct.
>
> > Start Parameter can be anything. Try the 2 urls below. They return the
> > expected results.
>
> >http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rs...
>
> >http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rs...
>
> > The point I am making is that once you go over 24 there are no results
> > returned.
>
> > E.g.http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rs...

Jeremy Geerdes

unread,
Sep 14, 2009, 9:09:44 AM9/14/09
to google-ajax...@googlegroups.com
Sorry; I meant starts of 22 and 23.

And yes, I would concur that it would be nice to be able to retrieve
the full number of results, regardless of whether you're using a small
or large resultset. I also wish that the exact nature of the start
parameter was documented so that we knew what were acceptable values
and not. If you like, you could add it to the issue tracker, available
at the link below:

http://code.google.com/p/google-ajax-apis/issues/list

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!
>>> E.g.http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rs

MarkOG

unread,
Sep 14, 2009, 9:29:03 AM9/14/09
to Google AJAX APIs
I have added an issue: http://code.google.com/p/google-ajax-apis/issues/detail?id=315

Thanks for the discussion.

Regards,
Mark.

On Sep 14, 2:09 pm, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> Sorry; I meant starts of 22 and 23.
>
> And yes, I would concur that it would be nice to be able to retrieve  
> the full number of results, regardless of whether you're using a small  
> or large resultset. I also wish that the exact nature of the start  
> parameter was documented so that we knew what were acceptable values  
> and not. If you like, you could add it to the issue tracker, available  
> at the link below:
>
> http://code.google.com/p/google-ajax-apis/issues/list
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.comhttp://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com
> jgeer...@mchsi.com
>
> Unless otherwise noted, any price quotes contained within this  
> communication are given in US dollars.
>
> If you're in the Des Moines, IA, area, check out Debra Heights  
> Wesleyan Church!
>
> And check out my blog, Adventures in Web Development, athttp://jgeerdes.blogspot.com
>   !
>
> On Sep 14, 2009, at 7:13 AM, MarkOG wrote:
>
>
>
> > Start parameter of 21 AND 22 return different results. See below
>
> >http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rs...
> > Results for start 21:
>
> > Item 1: M Automotive
> > Item 2: San Francisco Auto Sport
> > Item 3: Enterprise Rent-A-Car - SF-Mission St
> > Item 4: Tom See S
>
> >http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=cars&rs...
> > Results for start 22:
>
> > Item 1: San Francisco Auto Sport
> > Item 2: Enterprise Rent-A-Car - SF-Mission St
> > Item 3: Tom See S
> > Item 4: KSH Automotive
>
> > When you compare the first set of results to the second set of results
> > you can see that the second search has removed the first item and
> > added a new item to the bottom of its results. This is the expected
> > and correct behaviour.
>
> > Therefore the start paramerter does seem to work correctly and return
> > different result sets.
>
> > Anyway forget about that for now.
> > I an not bothered exactly how the code works or why you can not get
> > the last 8 results.
>
> > My real gripe is:
> > I think that we should be able to retrieve the last 8 items out of the
> > possible 32 items, whether we are using a small result set or a large
> > result set.
> > Even when doing a web search (that returns 64 results) instead of a
> > local search, when requesting a small set of results, you are unable
> > to access the last 8 items.
>
> > If this behaviour is by design then is behaviour is a limitation and
> > should be documented in the Google AJAX Search API documentation.
> > E.g. Herehttp://code.google.com/apis/ajaxsearch/documentation/reference.html#_...
Reply all
Reply to author
Forward
0 new messages