From 76792431bea993a4ed2d31352d3c215e02c97064 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 13 Apr 2018 00:37:47 -0500 Subject: [PATCH] Fix #3636: Tag similarity on autocomplete no longer working. --- app/models/tag.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index 7b8d41af5..3d2291c5a 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -852,7 +852,7 @@ class Tag < ApplicationRecord def order_similarity(name) # trunc(3 * sim) reduces the similarity score from a range of 0.0 -> 1.0 to just 0, 1, or 2. # This groups tags first by approximate similarity, then by largest tags within groups of similar tags. - order("trunc(3 * similarity(name, #{sanitize(name)})) DESC", "post_count DESC", "name DESC") + order("trunc(3 * similarity(name, #{connection.quote(name)})) DESC", "post_count DESC", "name DESC") end # ref: https://www.postgresql.org/docs/current/static/pgtrgm.html#idm46428634524336