Are all the "total_results" accessible from the api?

Hello,

I am continuing my investigation to working with the api. Using my test query the first response (page 1 with first 20 results) states that there are over 54,000 results.

Now I want to get the last “page” of the result. I calculate that using

ch.Page_no = (ch.Total_results / ch.Items_per_page);
ch.Page_no = (ch.Total_results % ch.Items_per_page == 0)? ch.Page_no - 1: ch.Page_no;

ch is my Companies house object and I have got Total_results from the first search and the items_per_page is a variable I can set but is set to the default of 20.

The HTTPClient request string is formed

url = string.Format("{0}?q={1}&start_index={2}&items_per_page={3}",
url,
theSearchtext,
page_no * items_per_page,
items_per_page);

The result always produces

{StatusCode: 416, ReasonPhrase: ‘Request Range Not Satisfiable’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Access-Control-Expose-Headers: Location,www-authenticate,cache-control,pragma,content-type,expires,last-modified
X-Ratelimit-Remain: 599
Pragma: no-cache
X-Ratelimit-Limit: 600
X-Ratelimit-Reset: 1488274783
Cache-Control: no-store, must-revalidate, no-cache, post-check=0, pre-check=0
Date: Tue, 28 Feb 2017 09:34:43 GMT
Content-Length: 0
}}

I then forced a number which I knew was well within the “total_results” number with the same result
I also have a “Next” button to get me the next 20 results. Scrolling through it never goes beyond the 381-400 results.

Is the system limited to this number?

Thanks

This is a system limitation, see the following for more information:-

Thanks Mark,

I look forward to a solution.
I know my results are greater than I want because the query searches in multiple places so the only way is to extract and filter.

If the query could be more specific then the results would be fewer. I know there are many ways to throttle and you have to stop people farming data and killing performance. So I hope you come up with a solution soon.