View Full Version : totalRecords == limit
Zaphod
04-20-2012, 07:47 PM
Maybe I'm just catching up to something... are you guys limiting results to one page now? Like, if I say that all I want is 20 records, it seems that the API comes back and tells me that all there are are 20 records.... if I then say I want 30, it tells me that the totalRecords is now 30... has this been the case for a while? Not a huge deal, just has me scratching my head tonight :)
prosperent brian
04-20-2012, 07:59 PM
We base the limit on the request, so if you request page 1, we only calculate page 1 of results. saves us a ton of processing.
Zaphod
04-21-2012, 07:53 AM
Ah, makes sense, thanks :)
So... can I ask the API for page 2?
prosperent brian
04-21-2012, 08:05 AM
Yeah, if you request for example 10 records per page, and page 1, we calculate 10 results. If you request page 2 10 results per page I believe we do 25 total results on our end. Page 4 limit of 10, we calculate 50 results, page 6 limit of 10 we calculate 100 results and so on. Since the VAST majority of searches don't go past that first page, we save hundreds of processor hours per day. We also memcache each of those result sets and limits. Since the result sets are typically smaller, we can cache 10X more results on our end as well.
prosperent brian
04-21-2012, 08:10 AM
I should also note that facets are always calculated on the full result set, so if we have a limit of 250, the facets are calculated based on that, it's only the product results that have the variable limit. This way, if you use facets, you always get all of the data.
Zaphod
04-21-2012, 01:49 PM
Very cool, Brian! Thanks for taking the time to explain :)
Powered by vBulletin™ Version 4.0.8 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.