Determine number of search results

13 views
Skip to first unread message

PITT

unread,
Nov 9, 2011, 11:47:29 PM11/9/11
to Otter API to Topsy
for the following query:

/search.json?q=from:captainhurst&window=a

I get the following results (partial):

[response] => stdClass Object
(
[window] => a
[page] => 1
[total] => 562
[perpage] => 10
[last_offset] => 0
[hidden] => 0
[list] => Array
(...)
)

I assumed that [total] is the total number of results found so I
should be able to retrieve 57 pages of results. I am able to iterate
over the pages by adding &page=$i to the above query, but only up to
15 pages. When I query for the 16th page, I receive the error:

Validation error: ''16'' not a valid value for ''page''

So my question is, is [total] meant to reflect the total number of
results found? If so, why can I only query 15 pages? If not, what is
the best way to determine the total number of pages?

Vipul Ved Prakash

unread,
Nov 11, 2011, 3:56:03 AM11/11/11
to otte...@googlegroups.com
Yes, total is the (maximum) number of results. There are a maximum of total / perpage number of pages.

cheers,
vipul

PITT

unread,
Nov 12, 2011, 1:05:20 AM11/12/11
to Otter API to Topsy
Thank you for the reply Vipul.

So in my example, I should be able to retrieve 57 pages of results
right? Why then would I get "Validation error: ''16'' not a valid
value for ''page''" when trying to access the 16th page? (/search.json?
q=from:captainhurst&window=a&page=16)
> > the best way to determine the total number of pages?- Hide quoted text -
>
> - Show quoted text -

Vipul Ved Prakash

unread,
Nov 15, 2011, 2:26:09 PM11/15/11
to otte...@googlegroups.com, PITT
The current implementation lets you set perpage to 100, so you can get all results with page=6&perpage=100.
Reply all
Reply to author
Forward
0 new messages