You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: sort posts search by score (single-subreddit/author scope) #56
Would it be possible to add sort_type=score to /api/posts/search.
This can be supported only when a subreddit or author filter
is present, and NOT supported for global/unfiltered queries.
Hi, I've thought about it too, but there are some challenges. It's simple to just create a (subreddit, score) index, but it might fail when a selected time range is chosen, that is far down in the index. For example If you want the most upvoted comments from r/AskReddit in 2018, there will be a lot a lot of comments in the index before 2018 is reached. Or when sorting post in ascending score order, there will be millions of posts with 0 or 1 upvotes.
Another approach might be to do an index over (subreddit, month, score). But I haven't tested that yet.
Currently my focus is on keeping the API running reliably. And introducing another potentially unpredictable parameter variation into the mix, is unfortunately at conflict with that.
That all makes sense, thanks for the detailed explanation.
Index on (subreddit, month, score) approach useful. My guess is that k-way merging the monthly score-sorted buckets would keep the work roughly bounded to the results actually being returned.
One possible compromise could be to constrain the feature a bit: only support score descending, require a subreddit or author filter, and cap the result window. That avoids the worst cases like ascending through millions of low-score posts entirely.
No rush either way, I appreciate you keeping the API stable.
Activity
ArthurHeitmann commentedon Jun 3, 2026
Hi, I've thought about it too, but there are some challenges. It's simple to just create a (subreddit, score) index, but it might fail when a selected time range is chosen, that is far down in the index. For example If you want the most upvoted comments from r/AskReddit in 2018, there will be a lot a lot of comments in the index before 2018 is reached. Or when sorting post in ascending score order, there will be millions of posts with 0 or 1 upvotes.
Another approach might be to do an index over (subreddit, month, score). But I haven't tested that yet.
Currently my focus is on keeping the API running reliably. And introducing another potentially unpredictable parameter variation into the mix, is unfortunately at conflict with that.
kanihal commentedon Jun 6, 2026
That all makes sense, thanks for the detailed explanation.
Index on (subreddit, month, score) approach useful. My guess is that k-way merging the monthly score-sorted buckets would keep the work roughly bounded to the results actually being returned.
One possible compromise could be to constrain the feature a bit: only support score descending, require a subreddit or author filter, and cap the result window. That avoids the worst cases like ascending through millions of low-score posts entirely.
No rush either way, I appreciate you keeping the API stable.