Class: CloudSearch::SearchResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/eden_cloud_search/search_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/eden_cloud_search/search_response.rb', line 4

def body
  @body
end

#current_pageObject (readonly)

Returns the value of attribute current_page.



4
5
6
# File 'lib/eden_cloud_search/search_response.rb', line 4

def current_page
  @current_page
end

#facetsObject (readonly)

Returns the value of attribute facets.



4
5
6
# File 'lib/eden_cloud_search/search_response.rb', line 4

def facets
  @facets
end

#http_codeObject

Returns the value of attribute http_code.



5
6
7
# File 'lib/eden_cloud_search/search_response.rb', line 5

def http_code
  @http_code
end

#items_per_pageObject Also known as: page_size, limit_value



26
27
28
# File 'lib/eden_cloud_search/search_response.rb', line 26

def items_per_page
  @items_per_page || 10
end

#total_pagesObject (readonly)

Returns the value of attribute total_pages.



4
5
6
# File 'lib/eden_cloud_search/search_response.rb', line 4

def total_pages
  @total_pages
end

Instance Method Details

#found?Boolean Also known as: any?

Returns:

  • (Boolean)


22
23
24
# File 'lib/eden_cloud_search/search_response.rb', line 22

def found?
  hits > 0
end

#has_pagination?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/eden_cloud_search/search_response.rb', line 30

def has_pagination?
  hits > items_per_page
end

#hitsObject Also known as: total_entries



18
19
20
# File 'lib/eden_cloud_search/search_response.rb', line 18

def hits
  _hits["found"] || 0
end

#offsetObject



34
35
36
37
# File 'lib/eden_cloud_search/search_response.rb', line 34

def offset
  return 0 unless found?
  (@current_page - 1) * items_per_page
end

#resultsObject



14
15
16
# File 'lib/eden_cloud_search/search_response.rb', line 14

def results
  _hits["hit"] || []
end