Class: Algolia::Search::BrowseResponse
- Inherits:
-
Object
- Object
- Algolia::Search::BrowseResponse
- Defined in:
- lib/algolia/models/search/browse_response.rb
Instance Attribute Summary collapse
-
#ab_test_id ⇒ Object
A/B test ID.
-
#ab_test_variant_id ⇒ Object
Variant ID.
-
#around_lat_lng ⇒ Object
Computed geographical location.
-
#automatic_radius ⇒ Object
Automatically-computed radius.
-
#cursor ⇒ Object
Cursor indicating the location to resume browsing from.
-
#exhaustive ⇒ Object
Returns the value of attribute exhaustive.
-
#exhaustive_facets_count ⇒ Object
See the ‘facetsCount` field of the `exhaustive` object in the response.
-
#exhaustive_nb_hits ⇒ Object
See the ‘nbHits` field of the `exhaustive` object in the response.
-
#exhaustive_typo ⇒ Object
See the ‘typo` field of the `exhaustive` object in the response.
-
#facets ⇒ Object
Mapping of each facet name to the corresponding facet counts.
-
#facets_stats ⇒ Object
Statistics for numerical facets.
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#hits_per_page ⇒ Object
Number of hits per page.
-
#index ⇒ Object
Index name used for the query.
-
#index_used ⇒ Object
Index name used for the query.
-
#message ⇒ Object
Warnings about the query.
-
#nb_hits ⇒ Object
Number of hits the search query matched.
-
#nb_pages ⇒ Object
Number of pages of results for the current query.
-
#nb_sorted_hits ⇒ Object
Number of hits selected and sorted by the relevant sort algorithm.
-
#page ⇒ Object
Page to retrieve (the first page is ‘0`, not `1`).
-
#params ⇒ Object
URL-encoded string of all search parameters.
-
#parsed_query ⇒ Object
Post-(www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.
-
#processing_time_ms ⇒ Object
Time the server took to process the request, in milliseconds.
-
#processing_timings_ms ⇒ Object
Experimental.
-
#query ⇒ Object
Text to search for in an index.
-
#query_after_removal ⇒ Object
Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.
-
#redirect ⇒ Object
Returns the value of attribute redirect.
-
#rendering_content ⇒ Object
Returns the value of attribute rendering_content.
-
#server_time_ms ⇒ Object
Time the server took to process the request, in milliseconds.
-
#server_used ⇒ Object
Host name of the server that processed the request.
-
#user_data ⇒ Object
Lets you store custom data in your indices.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3).
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.types_mapping ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ BrowseResponse
constructor
Initializes the object.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ BrowseResponse
Initializes the object
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/algolia/models/search/browse_response.rb', line 193 def initialize(attributes = {}) unless attributes.is_a?(Hash) raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::BrowseResponse` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) do |(k, v), h| unless self.class.attribute_map.key?(k.to_sym) raise ArgumentError, "`#{k}` is not a valid attribute in `Algolia::BrowseResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v end if attributes.key?(:ab_test_id) self.ab_test_id = attributes[:ab_test_id] end if attributes.key?(:ab_test_variant_id) self.ab_test_variant_id = attributes[:ab_test_variant_id] end if attributes.key?(:around_lat_lng) self.around_lat_lng = attributes[:around_lat_lng] end if attributes.key?(:automatic_radius) self.automatic_radius = attributes[:automatic_radius] end if attributes.key?(:exhaustive) self.exhaustive = attributes[:exhaustive] end if attributes.key?(:exhaustive_facets_count) self.exhaustive_facets_count = attributes[:exhaustive_facets_count] end if attributes.key?(:exhaustive_nb_hits) self.exhaustive_nb_hits = attributes[:exhaustive_nb_hits] end if attributes.key?(:exhaustive_typo) self.exhaustive_typo = attributes[:exhaustive_typo] end if attributes.key?(:facets) if (value = attributes[:facets]).is_a?(Hash) self.facets = value end end if attributes.key?(:facets_stats) if (value = attributes[:facets_stats]).is_a?(Hash) self.facets_stats = value end end if attributes.key?(:hits_per_page) self.hits_per_page = attributes[:hits_per_page] else self.hits_per_page = nil end if attributes.key?(:index) self.index = attributes[:index] end if attributes.key?(:index_used) self.index_used = attributes[:index_used] end if attributes.key?(:message) self. = attributes[:message] end if attributes.key?(:nb_hits) self.nb_hits = attributes[:nb_hits] else self.nb_hits = nil end if attributes.key?(:nb_pages) self.nb_pages = attributes[:nb_pages] else self.nb_pages = nil end if attributes.key?(:nb_sorted_hits) self.nb_sorted_hits = attributes[:nb_sorted_hits] end if attributes.key?(:page) self.page = attributes[:page] else self.page = nil end if attributes.key?(:parsed_query) self.parsed_query = attributes[:parsed_query] end if attributes.key?(:processing_time_ms) self.processing_time_ms = attributes[:processing_time_ms] else self.processing_time_ms = nil end if attributes.key?(:processing_timings_ms) self.processing_timings_ms = attributes[:processing_timings_ms] end if attributes.key?(:query_after_removal) self.query_after_removal = attributes[:query_after_removal] end if attributes.key?(:redirect) self.redirect = attributes[:redirect] end if attributes.key?(:rendering_content) self.rendering_content = attributes[:rendering_content] end if attributes.key?(:server_time_ms) self.server_time_ms = attributes[:server_time_ms] end if attributes.key?(:server_used) self.server_used = attributes[:server_used] end if attributes.key?(:user_data) self.user_data = attributes[:user_data] end if attributes.key?(:hits) if (value = attributes[:hits]).is_a?(Array) self.hits = value end else self.hits = nil end if attributes.key?(:query) self.query = attributes[:query] else self.query = nil end if attributes.key?(:params) self.params = attributes[:params] else self.params = nil end if attributes.key?(:cursor) self.cursor = attributes[:cursor] end end |
Instance Attribute Details
#ab_test_id ⇒ Object
A/B test ID. This is only included in the response for indices that are part of an A/B test.
10 11 12 |
# File 'lib/algolia/models/search/browse_response.rb', line 10 def ab_test_id @ab_test_id end |
#ab_test_variant_id ⇒ Object
Variant ID. This is only included in the response for indices that are part of an A/B test.
13 14 15 |
# File 'lib/algolia/models/search/browse_response.rb', line 13 def ab_test_variant_id @ab_test_variant_id end |
#around_lat_lng ⇒ Object
Computed geographical location.
16 17 18 |
# File 'lib/algolia/models/search/browse_response.rb', line 16 def around_lat_lng @around_lat_lng end |
#automatic_radius ⇒ Object
Automatically-computed radius.
19 20 21 |
# File 'lib/algolia/models/search/browse_response.rb', line 19 def automatic_radius @automatic_radius end |
#cursor ⇒ Object
Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, ‘cursor` is absent from the response.
96 97 98 |
# File 'lib/algolia/models/search/browse_response.rb', line 96 def cursor @cursor end |
#exhaustive ⇒ Object
Returns the value of attribute exhaustive.
21 22 23 |
# File 'lib/algolia/models/search/browse_response.rb', line 21 def exhaustive @exhaustive end |
#exhaustive_facets_count ⇒ Object
See the ‘facetsCount` field of the `exhaustive` object in the response.
24 25 26 |
# File 'lib/algolia/models/search/browse_response.rb', line 24 def exhaustive_facets_count @exhaustive_facets_count end |
#exhaustive_nb_hits ⇒ Object
See the ‘nbHits` field of the `exhaustive` object in the response.
27 28 29 |
# File 'lib/algolia/models/search/browse_response.rb', line 27 def exhaustive_nb_hits @exhaustive_nb_hits end |
#exhaustive_typo ⇒ Object
See the ‘typo` field of the `exhaustive` object in the response.
30 31 32 |
# File 'lib/algolia/models/search/browse_response.rb', line 30 def exhaustive_typo @exhaustive_typo end |
#facets ⇒ Object
Mapping of each facet name to the corresponding facet counts.
33 34 35 |
# File 'lib/algolia/models/search/browse_response.rb', line 33 def facets @facets end |
#facets_stats ⇒ Object
Statistics for numerical facets.
36 37 38 |
# File 'lib/algolia/models/search/browse_response.rb', line 36 def facets_stats @facets_stats end |
#hits ⇒ Object
Returns the value of attribute hits.
87 88 89 |
# File 'lib/algolia/models/search/browse_response.rb', line 87 def hits @hits end |
#hits_per_page ⇒ Object
Number of hits per page.
39 40 41 |
# File 'lib/algolia/models/search/browse_response.rb', line 39 def hits_per_page @hits_per_page end |
#index ⇒ Object
Index name used for the query.
42 43 44 |
# File 'lib/algolia/models/search/browse_response.rb', line 42 def index @index end |
#index_used ⇒ Object
Index name used for the query. During A/B testing, the targeted index isn’t always the index used by the query.
45 46 47 |
# File 'lib/algolia/models/search/browse_response.rb', line 45 def index_used @index_used end |
#message ⇒ Object
Warnings about the query.
48 49 50 |
# File 'lib/algolia/models/search/browse_response.rb', line 48 def @message end |
#nb_hits ⇒ Object
Number of hits the search query matched.
51 52 53 |
# File 'lib/algolia/models/search/browse_response.rb', line 51 def nb_hits @nb_hits end |
#nb_pages ⇒ Object
Number of pages of results for the current query.
54 55 56 |
# File 'lib/algolia/models/search/browse_response.rb', line 54 def nb_pages @nb_pages end |
#nb_sorted_hits ⇒ Object
Number of hits selected and sorted by the relevant sort algorithm.
57 58 59 |
# File 'lib/algolia/models/search/browse_response.rb', line 57 def nb_sorted_hits @nb_sorted_hits end |
#page ⇒ Object
Page to retrieve (the first page is ‘0`, not `1`).
60 61 62 |
# File 'lib/algolia/models/search/browse_response.rb', line 60 def page @page end |
#params ⇒ Object
URL-encoded string of all search parameters.
93 94 95 |
# File 'lib/algolia/models/search/browse_response.rb', line 93 def params @params end |
#parsed_query ⇒ Object
Post-(www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.
63 64 65 |
# File 'lib/algolia/models/search/browse_response.rb', line 63 def parsed_query @parsed_query end |
#processing_time_ms ⇒ Object
Time the server took to process the request, in milliseconds.
66 67 68 |
# File 'lib/algolia/models/search/browse_response.rb', line 66 def processing_time_ms @processing_time_ms end |
#processing_timings_ms ⇒ Object
Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.
69 70 71 |
# File 'lib/algolia/models/search/browse_response.rb', line 69 def processing_timings_ms @processing_timings_ms end |
#query ⇒ Object
Text to search for in an index.
90 91 92 |
# File 'lib/algolia/models/search/browse_response.rb', line 90 def query @query end |
#query_after_removal ⇒ Object
Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.
72 73 74 |
# File 'lib/algolia/models/search/browse_response.rb', line 72 def query_after_removal @query_after_removal end |
#redirect ⇒ Object
Returns the value of attribute redirect.
74 75 76 |
# File 'lib/algolia/models/search/browse_response.rb', line 74 def redirect @redirect end |
#rendering_content ⇒ Object
Returns the value of attribute rendering_content.
76 77 78 |
# File 'lib/algolia/models/search/browse_response.rb', line 76 def rendering_content @rendering_content end |
#server_time_ms ⇒ Object
Time the server took to process the request, in milliseconds.
79 80 81 |
# File 'lib/algolia/models/search/browse_response.rb', line 79 def server_time_ms @server_time_ms end |
#server_used ⇒ Object
Host name of the server that processed the request.
82 83 84 |
# File 'lib/algolia/models/search/browse_response.rb', line 82 def server_used @server_used end |
#user_data ⇒ Object
Lets you store custom data in your indices.
85 86 87 |
# File 'lib/algolia/models/search/browse_response.rb', line 85 def user_data @user_data end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/algolia/models/search/browse_response.rb', line 482 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Algolia::Search.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
136 137 138 |
# File 'lib/algolia/models/search/browse_response.rb', line 136 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/algolia/models/search/browse_response.rb', line 99 def self.attribute_map { :ab_test_id => :abTestID, :ab_test_variant_id => :abTestVariantID, :around_lat_lng => :aroundLatLng, :automatic_radius => :automaticRadius, :exhaustive => :exhaustive, :exhaustive_facets_count => :exhaustiveFacetsCount, :exhaustive_nb_hits => :exhaustiveNbHits, :exhaustive_typo => :exhaustiveTypo, :facets => :facets, :facets_stats => :facets_stats, :hits_per_page => :hitsPerPage, :index => :index, :index_used => :indexUsed, :message => :message, :nb_hits => :nbHits, :nb_pages => :nbPages, :nb_sorted_hits => :nbSortedHits, :page => :page, :parsed_query => :parsedQuery, :processing_time_ms => :processingTimeMS, :processing_timings_ms => :processingTimingsMS, :query_after_removal => :queryAfterRemoval, :redirect => :redirect, :rendering_content => :renderingContent, :server_time_ms => :serverTimeMS, :server_used => :serverUsed, :user_data => :userData, :hits => :hits, :query => :query, :params => :params, :cursor => :cursor } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
# File 'lib/algolia/models/search/browse_response.rb', line 457 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} types_mapping.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash[key.to_s] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3)
183 184 185 186 187 188 189 |
# File 'lib/algolia/models/search/browse_response.rb', line 183 def self.openapi_all_of [ :BaseSearchResponse, :Cursor, :SearchHits ] end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
178 179 180 |
# File 'lib/algolia/models/search/browse_response.rb', line 178 def self.openapi_nullable Set.new([]) end |
.types_mapping ⇒ Object
Attribute type mapping.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/algolia/models/search/browse_response.rb', line 141 def self.types_mapping { :ab_test_id => :Integer, :ab_test_variant_id => :Integer, :around_lat_lng => :String, :automatic_radius => :String, :exhaustive => :Exhaustive, :exhaustive_facets_count => :Boolean, :exhaustive_nb_hits => :Boolean, :exhaustive_typo => :Boolean, :facets => :'Hash<String, Hash<String, Integer>>', :facets_stats => :'Hash<String, FacetsStats>', :hits_per_page => :Integer, :index => :String, :index_used => :String, :message => :String, :nb_hits => :Integer, :nb_pages => :Integer, :nb_sorted_hits => :Integer, :page => :Integer, :parsed_query => :String, :processing_time_ms => :Integer, :processing_timings_ms => :Object, :query_after_removal => :String, :redirect => :Redirect, :rendering_content => :RenderingContent, :server_time_ms => :Integer, :server_used => :String, :user_data => :Object, :hits => :'Array<Hit>', :query => :String, :params => :String, :cursor => :String } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/algolia/models/search/browse_response.rb', line 404 def ==(other) return true if equal?(other) self.class == other.class && ab_test_id == other.ab_test_id && ab_test_variant_id == other.ab_test_variant_id && around_lat_lng == other.around_lat_lng && automatic_radius == other.automatic_radius && exhaustive == other.exhaustive && exhaustive_facets_count == other.exhaustive_facets_count && exhaustive_nb_hits == other.exhaustive_nb_hits && exhaustive_typo == other.exhaustive_typo && facets == other.facets && facets_stats == other.facets_stats && hits_per_page == other.hits_per_page && index == other.index && index_used == other.index_used && == other. && nb_hits == other.nb_hits && nb_pages == other.nb_pages && nb_sorted_hits == other.nb_sorted_hits && page == other.page && parsed_query == other.parsed_query && processing_time_ms == other.processing_time_ms && processing_timings_ms == other.processing_timings_ms && query_after_removal == other.query_after_removal && redirect == other.redirect && rendering_content == other.rendering_content && server_time_ms == other.server_time_ms && server_used == other.server_used && user_data == other.user_data && hits == other.hits && query == other.query && params == other.params && cursor == other.cursor end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
553 554 555 556 557 558 559 560 561 562 563 564 565 |
# File 'lib/algolia/models/search/browse_response.rb', line 553 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(other) ⇒ Boolean
443 444 445 |
# File 'lib/algolia/models/search/browse_response.rb', line 443 def eql?(other) self == other end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
449 450 451 452 |
# File 'lib/algolia/models/search/browse_response.rb', line 449 def hash [ab_test_id, ab_test_variant_id, around_lat_lng, automatic_radius, exhaustive, exhaustive_facets_count, exhaustive_nb_hits, exhaustive_typo, facets, facets_stats, hits_per_page, index, index_used, , nb_hits, nb_pages, nb_sorted_hits, page, parsed_query, processing_time_ms, processing_timings_ms, query_after_removal, redirect, rendering_content, server_time_ms, server_used, user_data, hits, query, params, cursor].hash end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
529 530 531 |
# File 'lib/algolia/models/search/browse_response.rb', line 529 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/algolia/models/search/browse_response.rb', line 535 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
523 524 525 |
# File 'lib/algolia/models/search/browse_response.rb', line 523 def to_s to_hash.to_s end |