mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: use sql_fragment instead of sanitize_sql_array (#11460)
This is a follow up to comment under this PR https://github.com/discourse/discourse/pull/11441 Sam suggested using sql_fragment instead of sanitize_sql_array
This commit is contained in:
committed by
GitHub
parent
aa0d4ea764
commit
3ea4f36f26
@@ -636,11 +636,11 @@ class Topic < ActiveRecord::Base
|
||||
|
||||
if raw.present?
|
||||
similars
|
||||
.select(sanitize_sql_array(["topics.*, similarity(topics.title, :title) + similarity(p.raw, :raw) AS similarity, p.cooked AS blurb", title: title, raw: raw]))
|
||||
.select(DB.sql_fragment("topics.*, similarity(topics.title, :title) + similarity(p.raw, :raw) AS similarity, p.cooked AS blurb", title: title, raw: raw))
|
||||
.where("similarity(topics.title, :title) + similarity(p.raw, :raw) > 0.2", title: title, raw: raw)
|
||||
else
|
||||
similars
|
||||
.select(sanitize_sql_array(["topics.*, similarity(topics.title, :title) AS similarity, p.cooked AS blurb", title: title]))
|
||||
.select(DB.sql_fragment("topics.*, similarity(topics.title, :title) AS similarity, p.cooked AS blurb", title: title))
|
||||
.where("similarity(topics.title, :title) > 0.2", title: title)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user