View this page "Search API"

0 views
Skip to first unread message

andrew.reutter

unread,
Mar 8, 2010, 3:17:50 PM3/8/10
to iplay4e-api
Our first public API documentation page is now up. It details the use
of the Search API.

Click on http://groups.google.com/group/iplay4e-api/web/search-api -
or copy & paste it into your browser's address bar if that doesn't
work.

Andrew Siefer

unread,
Mar 25, 2010, 7:45:28 PM3/25/10
to iplay4e-api
Looking for a little more detail on the under-the-hood behavior of the
search API. Specifically, how does the API determine the number of
results per page? For most searches it seems to return 5 per page,
however I've seen 6 result items returned on a single page as well.
As of writing this post, searching for "test 1-30" returns a total of
6 results on a single page. I'd like to trim down my result list to
only 5 rows if I can, but with the current behavior I'm not sure I
can.

Andrew

Andrew Reutter

unread,
Mar 25, 2010, 9:44:03 PM3/25/10
to iplay...@googlegroups.com
The API currently puts 5 results on a page, but won't "orphan" a
single result. So if the number of results is 6, 11, 16, etc...the
last page will have 6 results.

Do you have a strong need to control that behavior, or does
understanding it suffice?

> To unsubscribe from this group, send email to iplay4e-api+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>

Andrew Siefer

unread,
Mar 25, 2010, 11:00:21 PM3/25/10
to iplay4e-api
I don't know that I'd use the word "strong," but take my situation
where I'm putting the search results into a list: If I make the list 5
rows high then every once in a while the user will have to scroll down
to the 6th result. On the flip side if I make the list 6 rows high
then most of the time the 6th row goes unused. I guess it'd be nice
if there were an optional parameter to the search API that allowed you
to specify the number of results per page, or an easier option,
allowed you to disable the "don't orphan" option.

Andrew

On Mar 25, 8:44 pm, Andrew Reutter <andrew.reut...@gmail.com> wrote:
> The API currently puts 5 results on a page, but won't "orphan" a
> single result.  So if the number of results is 6, 11, 16, etc...the
> last page will have 6 results.
>
> Do you have a strong need to control that behavior, or does
> understanding it suffice?
>

Andrew Siefer

unread,
Mar 25, 2010, 11:14:06 PM3/25/10
to iplay4e-api
Never mind, I can code around it. Looks like if you ask for page 2 of
a search with 6 results it'll return the orphaned item like would be
expected.

Andrew

Andrew Reutter

unread,
Mar 26, 2010, 1:16:50 AM3/26/10
to iplay...@googlegroups.com
I was just replying to your earlier message; glad I saw this one. Nice
workaround!

Cheers,
Andrew d'iPlay4e

Andrew Siefer

unread,
Mar 26, 2010, 11:01:23 AM3/26/10
to iplay4e-api
In order to help future readers of this thread, I wanted to clarify
exactly how the API acts. I missed that I had some code in last night
that was making it appear to return only the 6th item if you asked for
the 2nd page. In fact, asking the API for the 2nd page will return
all 6 results again.

If you only wish to display a maximum of 5 results per page then order
to code around this behavior, your algorithm will have to 1) only
display the first 5 results of any page and 2) if more than 5 results
are returned, by definition you have only one more page after the
current and the next page of results will have to skip over the first
5 results, displaying only the 6th. Note that it is safe to ask for a
page number higher than the total number of results would normally
provide, as evidenced by this search asking for the 100th page of a
search with only 6 results:

http://iplay4e.appspot.com/search?q=test+1-30&p=100

Hope this makes it clear for anyone who need it.

Andrew

Andrew Reutter

unread,
Mar 26, 2010, 11:25:05 AM3/26/10
to iplay...@googlegroups.com
Wow, thanks for this, Andrew.

I just updated your group membership to give you permission to edit
pages. Would you mind adding this as a technical note to the Search
API page?

Thanks,
Andrew

Andrew Siefer

unread,
Mar 26, 2010, 1:53:49 PM3/26/10
to iplay4e-api
Done

On Mar 26, 10:25 am, Andrew Reutter <andrew.reut...@gmail.com> wrote:
> Wow, thanks for this, Andrew.
>
> I just updated your group membership to give you permission to edit
> pages.  Would you mind adding this as a technical note to the Search
> API page?
>
> Thanks,
> Andrew
>

Andrew Reutter

unread,
Mar 26, 2010, 1:58:34 PM3/26/10
to iplay...@googlegroups.com
You are the man, sir. Again.
Reply all
Reply to author
Forward
0 new messages