Class: Esearch::Presenter::Search

Inherits:
Esearch::Presenter show all
Defined in:
lib/esearch/presenter/search.rb

Overview

Presenter for search result

Instance Method Summary collapse

Instance Method Details

#facetsHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return facets

Returns:

  • (Hash)


12
13
14
15
16
# File 'lib/esearch/presenter/search.rb', line 12

def facets
  raw.fetch('facets', {}).each_with_object({}) do |(name, body), hash|
    hash[name] = Facet.build(body)
  end
end

#hitsEnumerable<Hash>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return hits

Returns:

  • (Enumerable<Hash>)


25
26
27
# File 'lib/esearch/presenter/search.rb', line 25

def hits
  Hits.new(raw.fetch('hits'))
end