FIX: Removes some duplicates in search results when the search context is a user.

This commit is contained in:
Robin Ward
2013-05-27 15:18:55 -04:00
parent 62a20f5655
commit 20e88f18ee
3 changed files with 15 additions and 11 deletions

View File

@ -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

View File

@ -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