PERF: Remove one extra call to Redis when searching.
This commit is contained in:
parent
5a3494b1e1
commit
3b08b15855
|
@ -69,7 +69,7 @@ class SearchController < ApplicationController
|
|||
result.error = I18n.t("search.extreme_load_error")
|
||||
else
|
||||
search = Search.new(@search_term, search_args)
|
||||
result = search.execute
|
||||
result = search.execute(readonly_mode: @readonly_mode)
|
||||
result.find_user_data(guardian) if result
|
||||
end
|
||||
|
||||
|
@ -129,7 +129,7 @@ class SearchController < ApplicationController
|
|||
)
|
||||
else
|
||||
search = Search.new(params[:term], search_args)
|
||||
result = search.execute
|
||||
result = search.execute(readonly_mode: @readonly_mode)
|
||||
end
|
||||
render_serialized(result, GroupedSearchResultSerializer, result: result)
|
||||
end
|
||||
|
|
|
@ -227,8 +227,8 @@ class Search
|
|||
end
|
||||
|
||||
# Query a term
|
||||
def execute
|
||||
if SiteSetting.log_search_queries? && @opts[:search_type].present? && !Discourse.readonly_mode?
|
||||
def execute(readonly_mode: Discourse.readonly_mode?)
|
||||
if SiteSetting.log_search_queries? && @opts[:search_type].present? && !readonly_mode
|
||||
status, search_log_id = SearchLog.log(
|
||||
term: @term,
|
||||
search_type: @opts[:search_type],
|
||||
|
|
Loading…
Reference in New Issue