From 07e19833f146f8b84ec3f28295122e8e90c0a02a Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 9 Jan 2025 17:51:17 +0300 Subject: [PATCH] search_posts method of SearchHelper wasn't assigning query updates --- app/helpers/search_helper.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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