Revert "add prefix index on tags (#3858)"

This reverts commit 8c564f055f.
This commit is contained in:
Albert Yi
2018-09-12 16:41:52 -07:00
parent c100600875
commit 6210c1554c
2 changed files with 3 additions and 11 deletions

View File

@@ -74,9 +74,9 @@ module TagAutocomplete
n += 2
end
regexp = "([a-z0-9])[a-z0-9']*($|[^a-z0-9']+)"
anchors = "^" + query.split("").map {|x| Regexp.escape(x)}.join(".*[#{PREFIX_BOUNDARIES}]")
Tag
.where('regexp_replace(name, ?, ?, ?) like ?', regexp, '\1', 'g', query.to_escaped_for_sql_like + '%')
.where("name ~ ?", anchors)
.where("post_count > ?", min_post_count)
.where("post_count > 0")
.order("post_count desc")