Class: CloudSearch::SearchResponse
- Inherits:
-
Object
- Object
- CloudSearch::SearchResponse
- Defined in:
- lib/cloud_search/search_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#http_code ⇒ Object
Returns the value of attribute http_code.
- #items_per_page ⇒ Object (also: #page_size, #limit_value)
-
#total_pages ⇒ Object
readonly
Returns the value of attribute total_pages.
Instance Method Summary collapse
- #found? ⇒ Boolean (also: #any?)
- #has_pagination? ⇒ Boolean
- #hits ⇒ Object (also: #total_entries)
- #offset ⇒ Object
- #results ⇒ Object
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/cloud_search/search_response.rb', line 4 def body @body end |
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page.
4 5 6 |
# File 'lib/cloud_search/search_response.rb', line 4 def current_page @current_page end |
#http_code ⇒ Object
Returns the value of attribute http_code.
5 6 7 |
# File 'lib/cloud_search/search_response.rb', line 5 def http_code @http_code end |
#items_per_page ⇒ Object Also known as: page_size, limit_value
25 26 27 |
# File 'lib/cloud_search/search_response.rb', line 25 def items_per_page @items_per_page || 10 end |
#total_pages ⇒ Object (readonly)
Returns the value of attribute total_pages.
4 5 6 |
# File 'lib/cloud_search/search_response.rb', line 4 def total_pages @total_pages end |
Instance Method Details
#found? ⇒ Boolean Also known as: any?
15 16 17 |
# File 'lib/cloud_search/search_response.rb', line 15 def found? hits > 0 end |
#has_pagination? ⇒ Boolean
29 30 31 |
# File 'lib/cloud_search/search_response.rb', line 29 def has_pagination? hits > items_per_page end |
#hits ⇒ Object Also known as: total_entries
11 12 13 |
# File 'lib/cloud_search/search_response.rb', line 11 def hits _hits["found"] || 0 end |
#offset ⇒ Object
33 34 35 36 |
# File 'lib/cloud_search/search_response.rb', line 33 def offset return 0 unless found? (@current_page - 1) * items_per_page end |
#results ⇒ Object
7 8 9 |
# File 'lib/cloud_search/search_response.rb', line 7 def results _hits["hit"] || [] end |