PERF: Shortcircuit Topic.similar_to if max_similar_results is 0 (#28023)
This commit is contained in:
parent
8ef69f4c56
commit
6fb91b85ba
|
@ -696,7 +696,9 @@ class Topic < ActiveRecord::Base
|
||||||
MAX_SIMILAR_BODY_LENGTH ||= 200
|
MAX_SIMILAR_BODY_LENGTH ||= 200
|
||||||
|
|
||||||
def self.similar_to(title, raw, user = nil)
|
def self.similar_to(title, raw, user = nil)
|
||||||
|
return [] if SiteSetting.max_similar_results == 0
|
||||||
return [] if title.blank?
|
return [] if title.blank?
|
||||||
|
|
||||||
raw = raw.presence || ""
|
raw = raw.presence || ""
|
||||||
search_data = Search.prepare_data(title.strip)
|
search_data = Search.prepare_data(title.strip)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue