Skip to content

Feature request: sort posts search by score (single-subreddit/author scope) #56

Open

Description

@kanihal

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.

pullpush search already does this - https://search.pullpush.io/ (although it has data only till May, 2025)

Image

I assume it would need (subreddit, score) / (author, score) indexes
to avoid the full-sort timeout case, so scoping it should keep the cost down.

Workaround I'm using currently: I fetch with a filter + fields=...,score and sort client-side.

Activity

  1. ArthurHeitmann commented on Jun 3, 2026

    @ArthurHeitmann
    Owner

    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.

  2. kanihal commented on Jun 6, 2026

    @kanihal
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions