mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:14:12 +08:00
FIX: Removes some duplicates in search results when the search context is a user.
This commit is contained in:
@ -12,7 +12,7 @@ class Search
|
||||
def topic_ids
|
||||
topic_results = @by_type[:topic]
|
||||
return Set.new if topic_results.blank?
|
||||
Set.new(topic_results.results.map(&:id))
|
||||
return topic_results.result_ids
|
||||
end
|
||||
|
||||
def as_json
|
||||
|
@ -1,11 +1,12 @@
|
||||
class Search
|
||||
|
||||
class SearchResultType
|
||||
attr_accessor :more, :results
|
||||
attr_accessor :more, :results, :result_ids
|
||||
|
||||
def initialize(type)
|
||||
@type = type
|
||||
@results = []
|
||||
@result_ids = Set.new
|
||||
@more = false
|
||||
end
|
||||
|
||||
@ -14,7 +15,9 @@ class Search
|
||||
end
|
||||
|
||||
def add(result)
|
||||
return if @result_ids.include?(result.id)
|
||||
@results << result
|
||||
@result_ids << result.id
|
||||
end
|
||||
|
||||
def as_json
|
||||
|
Reference in New Issue
Block a user