Class: Esearch::Presenter::Hits

Inherits:
Esearch::Presenter show all
Includes:
Enumerable
Defined in:
lib/esearch/presenter/hits.rb

Overview

Presenter for elasticsearch result hits

Instance Method Summary collapse

Instance Method Details

#eachself, Enumerator<Hit>

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.

Enumerate contents

Returns:

  • (self)

    if block given

  • (Enumerator<Hit>)

    otherwise



20
21
22
23
24
25
26
27
28
# File 'lib/esearch/presenter/hits.rb', line 20

def each
  return to_enum unless block_given?

  hits.each do |hit|
    yield Hit.new(hit)
  end

  self
end

#sizeFixnum

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 amount of hits in this request

Returns:

  • (Fixnum)


36
37
38
# File 'lib/esearch/presenter/hits.rb', line 36

def size
  hits.size
end

#totalFixnum

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 total amount of hits in the query

Returns:

  • (Fixnum)


46
# File 'lib/esearch/presenter/hits.rb', line 46

expose_primitive('total')