guptahanu / google-ajax-apis

Automatically exported from code.google.com/p/google-ajax-apis
0 stars 1 forks source link

Incorrect currentPageIndex #455

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

http://ajax.googleapis.com/ajax/services/search/news?v=1.0&q=Daryl%20Cagle&rsz=l
arge&start=32

What is the expected output? What do you see instead?

"estimatedResultCount":"26","currentPageIndex":3,
The currentPageIndex should be 4!
But it gives the same results as start=24 (3 news issues)

Original issue reported on code.google.com by iron9li...@gmail.com on 8 May 2010 at 1:00

GoogleCodeExporter commented 8 years ago
If there are only 26 results, then there is no page index 4. So the API returns 
the
last page it actually has. I guess I would think of this more as a feature than 
a bug?

Maybe we make it a suggestion that, rather than returning the last page of 
results,
the API would report a useful error message.

Original comment by jrgeer...@gmail.com on 10 May 2010 at 3:23

GoogleCodeExporter commented 8 years ago
I'm the author of Google API for .NET project.
If you do think this is all right(then what does 400:OutOfRangeStatus mean???)
I gonna start to change my code.

Please make sure!

Original comment by iron9li...@gmail.com on 11 May 2010 at 3:09

GoogleCodeExporter commented 8 years ago
Well, here's the deal that I've found in some experimentation and with in some
consultation with the dev team. You will get the out of range status if the sum 
of
the start param you specify and the result set size you request (i.e., 4 for 
small, 8
for large) is greater than the absolute last result index you can get. In the 
case of
LocalSearch, this means that if start + resultsetsize > 31, you get the 400 
error.
And in the case of all others, start + resultsetsize > 63.

In the situation where there are fewer results, though, you will simply get the 
last
available resultset. So if you specify start=24, but there are only 18 results, 
the
API will respond as though you specified start=16.

Notice, though, that the estimatedResultCount, pages array, and 
currentPageIndex are
populated accordingly. So if you're wanting to get all of the results, check the
currentPageIndex against the pagesArray to see if there are additional pages to 
retrieve.

Original comment by jrgeer...@gmail.com on 11 May 2010 at 5:47

GoogleCodeExporter commented 8 years ago
Hello jrgeerdes,
Thank you for the answer.
I think it is very important to let all the restful users know this.
You should update the document.

And I do think it is not a good idea just return the last possible results.

I will fix my code.

Thanks again.

IL

Original comment by iron9li...@gmail.com on 12 May 2010 at 2:43