Sha256: 7a68fcc00ae806312e14883877092b500e05f552baa7fdff05195cab16930a52
Contents?: true
Size: 576 Bytes
Versions: 6
Compression:
Stored size: 576 Bytes
Contents
module Gummi module Document module Search class Result attr_reader :took, :total, :hits, :facets def initialize(result) @took = result["took"] @total = result["hits"]["total"] @hits = result["hits"]["hits"] @facets = result["facets"] end def records hits.map do |hit| model = "DB::#{hit["_type"].humanize}".constantize doc_hash = {id: hit["_id"]}.merge(hit["_source"]) model.new(doc_hash) end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems