mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 18:33:28 +08:00

Similar to `advanced_filter` I introduced `advanced_order`. I needed a new option because default orders are evaluated after advanced_filter so I couldn't use it. Also, that part is a little bit more generic ``` elsif word =~ /order:\w+/ @order = word.gsub('order:', '').to_sym nil ``` After those changes, I can use them in plugins in this way: ``` Search.advanced_order(:votes) do |posts| posts.reorder("COALESCE((SELECT dvvc.counter FROM discourse_voting_vote_counters dvvc WHERE dvvc.topic_id = subquery.topic_id), 0) DESC") end ```