Fix #3871: Autocomplete can return duplicate tags.

This commit is contained in:
evazion
2018-09-05 18:55:49 -05:00
parent 4b9f3e384f
commit c2cf6a5441
2 changed files with 6 additions and 1 deletions

View File

@@ -23,7 +23,7 @@ module TagAutocomplete
end
def count_sort(query, words)
words.uniq.sort_by do |x|
words.uniq(&:name).sort_by do |x|
x.post_count * x.weight
end.reverse.slice(0, LIMIT)
end