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")
|
result.error = I18n.t("search.extreme_load_error")
|
||||||
else
|
else
|
||||||
search = Search.new(@search_term, search_args)
|
search = Search.new(@search_term, search_args)
|
||||||
result = search.execute
|
result = search.execute(readonly_mode: @readonly_mode)
|
||||||
result.find_user_data(guardian) if result
|
result.find_user_data(guardian) if result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class SearchController < ApplicationController
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
search = Search.new(params[:term], search_args)
|
search = Search.new(params[:term], search_args)
|
||||||
result = search.execute
|
result = search.execute(readonly_mode: @readonly_mode)
|
||||||
end
|
end
|
||||||
render_serialized(result, GroupedSearchResultSerializer, result: result)
|
render_serialized(result, GroupedSearchResultSerializer, result: result)
|
||||||
end
|
end
|
||||||
|
|
|
@ -227,8 +227,8 @@ class Search
|
||||||
end
|
end
|
||||||
|
|
||||||
# Query a term
|
# Query a term
|
||||||
def execute
|
def execute(readonly_mode: Discourse.readonly_mode?)
|
||||||
if SiteSetting.log_search_queries? && @opts[:search_type].present? && !Discourse.readonly_mode?
|
if SiteSetting.log_search_queries? && @opts[:search_type].present? && !readonly_mode
|
||||||
status, search_log_id = SearchLog.log(
|
status, search_log_id = SearchLog.log(
|
||||||
term: @term,
|
term: @term,
|
||||||
search_type: @opts[:search_type],
|
search_type: @opts[:search_type],
|
||||||
|
|
Loading…
Reference in New Issue