That makes a lot of sense. Good tip on the TIMESTAMP also.
d
On Monday, March 26, 2012 5:58:07 PM, Vipul Ved Prakash wrote:
> The two queries you mention are not equivalent. It's required to pass
> "last_offset" as "offset" when you are fetching the next page.
>
> In a process termed "post filtering", the API layer applies filters to
> search results (for de-deping, profanity, etc) that come from the main
> search index. If results are filtered due to this post filtering, the
> last_offset value is incremented and communicated to the caller. eg:
> If there were 30 results, and first 4 were filtered, then
> q=QUERY&page=1&perpage=10 will return 10 results with last_offset set
> to 14. You should then get the next 10 results with
> q=QUERY&page=2&offset=14.
>
> There's another finer point re consistency. Topsy is a real-time
> index, so it's possible that the result set has changed by the time
> you fetch page #2. If you want your results to be consistent, you
> should add a maxtime=TIMESTAMP parameter to both page1 and page2.
> TIMESTAMP can be current clock time when page1 query is issued.
>
> Hope this helps.
>
> cheers,
> vipul
>
> On Wednesday, February 15, 2012 9:36:24 AM UTC-8, David Rees
> (@studgeek) wrote:
>
> I would like to clarify the usage of the *offset *and the *page
> *List Parameters
> <http://code.google.com/p/otterapi/wiki/ResListParameters>. Am I
> correct they are redundant with each other?
>
> So given an initial query of
> http://otter.topsy.com/search.json?q=New+York&perpage=25
> <http://otter.topsy.com/search.json?q=New+York&perpage=25>
> either of these 2nd queries will give the same results? Is that
> correct?
> http://otter.topsy.com/search.json?q=New+York&perpage=25&page=2
> <http://otter.topsy.com/search.json?q=New+York&perpage=25&page=2>
> http://otter.topsy.com/search.json?q=New+York&perpage=25&offset=25
> <http://otter.topsy.com/search.json?q=New+York&perpage=25&offset=25>
>
> I also have a question about consistency across queries. Since
> there is no session key used, can't the query result and its
> ordering change between the query for page 1 and page 2? So items
> could be missed or not line up between the two queries? Or if
> there some sort of time window the underlying query is guaranteed
> to be involitale?
>
> In either case, I think the examples need to be updated. The first
> URL example is the one with the problem. It think it has 3 or 4
> issues:
>
> * It should come second (since its getting the 2nd page)
> * It should still have the perpage=25
> * It only needs a page or an offset, not both I think?
> * If it does have an offset, it should be 25 not 24.
>
>
> Thanks,
> dave
>