Sha256: 09816188a284a1c247414a98c74d4e0b056abf6ec3c91868dd22f53149546464
Contents?: true
Size: 516 Bytes
Versions: 1
Compression:
Stored size: 516 Bytes
Contents
module Gummi 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gummi-0.0.6 | lib/gummi/search/result.rb |