Hi All
I have a weird problem when using the search_after parameter to retrieve a group of several thousand annotations.
I have used a search term of the following form (in python):-
r = requests.get(api_url_base+'search?'+'group=<GROUP>&user=<USER>&search_after='+last_record+'&order=desc&sort=created&limit=200&tag=<TAG>', headers=headers)
where the "last_record" entry is the retrieved date-created time stamp of the last annotation in the previous batch.
Retrieving in batches of 200 (which is the single search limit) I iterate through to get the full set, which is 2589 annotations.
When I do this I can never retrieve all of the annotations in the set; the most I can recover is 1819. I have exhaustively tested this ensuring that I am ordering and sorting the queries in exactly the same way (which I've also checked).
Bizarrely, the maximum number of annotations I can recover varies depending on how I set the limit in each batch. So, looping until "complete" I get the following:-
batch_size (max return)
20 (499)
30 (739)
40 (899)
50 (1069)
100 (1519)
150 (1819)
200 (1819) [limit]
I've spent a long time debugging and testing the elements of this, but cannot find an explanation as to why this is happening. Perhaps I'm mis-understanding how this is supposed to work, but from the blog and API entry it seems extremely straightforward, but just not working as intended. Does anyone know what I'm doing wrong, or whether this reveals a problem with the search function?
Also, is there a better/more efficient way of doing this, it seems incredibly clunky.
Any help, much appreciated.
Best wishes
Ian