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)


14
15
16
17
18
# File 'lib/esearch/presenter/search.rb', line 14

def facets
  raw.fetch('facets', {}).each_with_object({}) do |(name, body), aggregate|
    aggregate[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>)


27
28
29
# File 'lib/esearch/presenter/search.rb', line 27

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