Allow more endpoints to use commentable_ids param

The commentable_ids param is a comma-delimited list of ids indicating
that only threads belonging to one of the specified commentables should
be returned. It can now be used by any endpoint that delegates to
handle_threads_query (most importantly "#{APIPREFIX}/threads"), and
the commentable_id field is now indexed for efficient filtering. The
motivation for this change is to allow clients that are filtering by
commentable_ids to avoid using the /search/threads endpoint, which does
not do sorting and pagination correctly.