Class: CloudSearch::SearchResponse
- Inherits:
-
Object
- Object
- CloudSearch::SearchResponse
- Defined in:
- lib/eden_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.
-
#facets ⇒ Object
readonly
Returns the value of attribute facets.
-
#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/eden_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/eden_cloud_search/search_response.rb', line 4 def current_page @current_page end |
#facets ⇒ Object (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_code ⇒ Object
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_page ⇒ Object 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_pages ⇒ Object (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?
22 23 24 |
# File 'lib/eden_cloud_search/search_response.rb', line 22 def found? hits > 0 end |
#has_pagination? ⇒ Boolean
30 31 32 |
# File 'lib/eden_cloud_search/search_response.rb', line 30 def has_pagination? hits > items_per_page end |
#hits ⇒ Object Also known as: total_entries
18 19 20 |
# File 'lib/eden_cloud_search/search_response.rb', line 18 def hits _hits["found"] || 0 end |
#offset ⇒ Object
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 |
#results ⇒ Object
14 15 16 |
# File 'lib/eden_cloud_search/search_response.rb', line 14 def results _hits["hit"] || [] end |