Wraps the search result sets for Tire::Multi::Search
# File lib/tire/multi_search.rb, line 45 def initialize(searches, results) @searches = searches @results = results @collection = @results.zip(@searches.to_a).map do |results, search| Tire::Results::Collection.new(results, search.options) end end
Return a specific result sets
# File lib/tire/multi_search.rb, line 54 def [] name if index = @searches.names.index(name) @collection[ index ] end end
# File lib/tire/multi_search.rb, line 60 def each(&block) @collection.each(&block) end
# File lib/tire/multi_search.rb, line 64 def each_pair(&block) @searches.names.zip(@collection).each(&block) end
# File lib/tire/multi_search.rb, line 68 def size @results.size end
Returns the multi-search result sets as a Hash with the search name as key and the results as value.
# File lib/tire/multi_search.rb, line 75 def to_hash result = {} each_pair { |name,results| result[name] = results } result end