Casecommons/pg_search — Issue #22: Default order_by scope 
Author: daniel2d2art
Created: 2011-12-18 12:53:47+00:00
State: open

By default pg_search sets "pg_search_rank" and "id" in order_by query.

ORDER BY pg_search_rank DESC, "product"."id" ASC

If you plug custom order, this scopes over default pg_search order, like:

ORDER BY pg_search_rank DESC, "product"."id" ASC, price ASC, updated_at DESC

IMO, it's best to exclude "id" for the default pg_search order query. This lets plug custom orders based first on "pg_search_rank" order criteria and following the custom order. But default incluing "id", breaks the order priorities.

As you know, we can reset the default order using "reorder", but I think it's better that pg_search defaults order query will be only by "pg_search_rank" and exclude "id"

Regards