Merge pull request #3071 from evazion/fix-order-index
Fix #3000: order: metatags aren't indexed.
This commit is contained in:
@@ -78,7 +78,7 @@ private
|
||||
end
|
||||
|
||||
def index_by_post
|
||||
@posts = Post.where("last_comment_bumped_at IS NOT NULL").tag_match(params[:tags]).reorder("last_comment_bumped_at DESC").paginate(params[:page], :limit => 5, :search_count => params[:search])
|
||||
@posts = Post.where("last_comment_bumped_at IS NOT NULL").tag_match(params[:tags]).reorder("last_comment_bumped_at DESC NULLS LAST").paginate(params[:page], :limit => 5, :search_count => params[:search])
|
||||
@posts.each # hack to force rails to eager load
|
||||
respond_with(@posts) do |format|
|
||||
format.html {render :action => "index_by_post"}
|
||||
|
||||
@@ -392,34 +392,34 @@ class PostQueryBuilder
|
||||
relation = relation.order("posts.id DESC")
|
||||
|
||||
when "score", "score_desc"
|
||||
relation = relation.order("posts.score DESC")
|
||||
relation = relation.order("posts.score DESC, posts.id DESC")
|
||||
|
||||
when "score_asc"
|
||||
relation = relation.order("posts.score ASC")
|
||||
relation = relation.order("posts.score ASC, posts.id ASC")
|
||||
|
||||
when "favcount"
|
||||
relation = relation.order("posts.fav_count DESC")
|
||||
relation = relation.order("posts.fav_count DESC, posts.id DESC")
|
||||
|
||||
when "favcount_asc"
|
||||
relation = relation.order("posts.fav_count ASC")
|
||||
relation = relation.order("posts.fav_count ASC, posts.id ASC")
|
||||
|
||||
when "change", "change_desc"
|
||||
relation = relation.order("posts.updated_at DESC")
|
||||
relation = relation.order("posts.updated_at DESC, posts.id DESC")
|
||||
|
||||
when "change_asc"
|
||||
relation = relation.order("posts.updated_at ASC")
|
||||
relation = relation.order("posts.updated_at ASC, posts.id ASC")
|
||||
|
||||
when "comment", "comm"
|
||||
relation = relation.order("posts.last_commented_at DESC NULLS LAST")
|
||||
relation = relation.order("posts.last_commented_at DESC NULLS LAST, posts.id DESC")
|
||||
|
||||
when "comment_asc", "comm_asc"
|
||||
relation = relation.order("posts.last_commented_at ASC NULLS LAST")
|
||||
relation = relation.order("posts.last_commented_at ASC NULLS LAST, posts.id ASC")
|
||||
|
||||
when "comment_bumped"
|
||||
relation = relation.order("posts.last_comment_bumped_at DESC NULLS LAST")
|
||||
|
||||
when "comment_bumped_asc"
|
||||
relation = relation.order("posts.last_comment_bumped_at ASC NULLS LAST")
|
||||
relation = relation.order("posts.last_comment_bumped_at ASC NULLS FIRST")
|
||||
|
||||
when "note"
|
||||
relation = relation.order("posts.last_noted_at DESC NULLS LAST")
|
||||
|
||||
Reference in New Issue
Block a user