Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Missing records during retrieval even when all shards are up #47

Open
strang3qu4rk opened this issue Jul 1, 2019 · 1 comment
Open
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@strang3qu4rk
Copy link

PSAW uses desc sort when making queries involving time intervals and uses last record in the previous request to set the next 'before' value for paging. However because the 'before' and 'after' values are not inclusive in Pushshift, if multiple records with same timestamp occur on the temporal boundaries of the paging requests there will be missing records in the retrieved results. Switching to asc sort will also produce missing records for the same reasons albeit different ones.

Example:

start = 1527811200 
 end = 1559347200 
 gen = api.search_comments(after=start, before=end,
                            subreddit='jobs', aggs='subreddit')
next(gen)

Output: {'subreddit': [{'doc_count': 353029, 'key': 'jobs'}]}

There should be 353029 records, however when the data is retrieved there are only 353024.

gen =list(api.search_comments(after=start, before=end,
                            subreddit='jobs'))
len(gen)

Output: 353024

This discrepancy happens even though all shards are up, in fact if they weren't aggs would be reporting a different value.

(Please note at the moment of writing this 4 shards are down so the test cannot be performed until that is fixed)
Quick check if all shards are up on this data range

@dmarx dmarx added bug Something isn't working help wanted Extra attention is needed labels Feb 29, 2020
@dmarx
Copy link
Owner

dmarx commented Mar 18, 2020

I'm pretty sure this describes what's going on: https://www.reddit.com/r/pushshift/comments/fkss97/how_to_access_all_records_for_a_timestamp_that/

The max results per request has been changed from 500 to 1000 since you asked this. Probably resolves your specific problem, but I'm gonna leave this open for now because I think the edge case that produced your issue is still a vulnerability that hasn't been fully addressed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants