Merge pull request #3490 from BrokenEagle/fix-autocomplete-results

Fix fuzzy autocomlete results
This commit is contained in:
Albert Yi
2018-01-03 11:33:11 -08:00
committed by GitHub

View File

@@ -943,7 +943,7 @@ class Tag < ApplicationRecord
tags = Tag.select("DISTINCT ON (name, post_count) *").from(sql_query).order("post_count desc").limit(10)
if tags.empty?
tags = Tag.fuzzy_name_matches(name).order_similarity(name).nonempty.limit(10)
tags = Tag.select("tags.name, tags.post_count, tags.category, null AS antecedent_name").fuzzy_name_matches(name).order_similarity(name).nonempty.limit(10)
end
tags