lib/search_flip/response.rb in search_flip-3.0.0.beta1 vs lib/search_flip/response.rb in search_flip-3.0.0.beta2
- old
+ new
@@ -164,18 +164,10 @@
# # => [#<SearchFlip::Result ...>, ...]
#
# @return [Array] An array of results
def results
- @results ||= hits["hits"].map do |hit|
- raw_result = hit["_source"]
-
- raw_result["_hit"] = hit.each_with_object({}) do |(key, value), hash|
- hash[key] = value if key != "_source"
- end
-
- Result.new(raw_result)
- end
+ @results ||= hits["hits"].map { |hit| Result.from_hit(hit) }
end
# Returns the named sugggetion, if a name is specified or alle suggestions.
#
# @example