Instead of @search.sort try to assign it into another variable. Also instead of results use result
class PostsController < ApplicationController
def index
@search = Post.search(params[:q])
@search_r = Post.find_with_reputation(:votes,:all, order: "votes desc") if @search.sorts.empty?
@posts = @search_r.result
end
end