PERF: Shortcircuit Topic.similar_to if max_similar_results is 0 (#28023)

This commit is contained in:
Daniel Waterworth 2024-07-22 15:03:34 -05:00 committed by GitHub
parent 8ef69f4c56
commit 6fb91b85ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -696,7 +696,9 @@ class Topic < ActiveRecord::Base
MAX_SIMILAR_BODY_LENGTH ||= 200
def self.similar_to(title, raw, user = nil)
return [] if SiteSetting.max_similar_results == 0
return [] if title.blank?
raw = raw.presence || ""
search_data = Search.prepare_data(title.strip)