diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index f37760a3e..fe21b7d35 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -20,13 +20,13 @@ def search_posts posts = qualifiers_to_sql(qualifiers, posts) posts = posts.paginate(page: params[:page], per_page: 25) - if search_string.present? - posts.search(search_data[:search]).user_sort({ term: params[:sort], default: :search_score }, - relevance: :search_score, score: :score, age: :created_at) - else - posts.user_sort({ term: params[:sort], default: :score }, - score: :score, age: :created_at) - end + posts = if search_string.present? + posts.search(search_data[:search]).user_sort({ term: params[:sort], default: :search_score }, + relevance: :search_score, score: :score, age: :created_at) + else + posts.user_sort({ term: params[:sort], default: :score }, + score: :score, age: :created_at) + end [posts, qualifiers] end