Class: Algolia::Search::BaseSearchParams

Inherits:
Object
  • Object
show all
Defined in:
lib/algolia/models/search/base_search_params.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BaseSearchParams

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
# File 'lib/algolia/models/search/base_search_params.rb', line 195

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::BaseSearchParams` 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::BaseSearchParams`. 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?(:query)
    self.query = attributes[:query]
  end

  if attributes.key?(:similar_query)
    self.similar_query = attributes[:similar_query]
  end

  if attributes.key?(:filters)
    self.filters = attributes[:filters]
  end

  if attributes.key?(:facet_filters)
    self.facet_filters = attributes[:facet_filters]
  end

  if attributes.key?(:optional_filters)
    self.optional_filters = attributes[:optional_filters]
  end

  if attributes.key?(:numeric_filters)
    self.numeric_filters = attributes[:numeric_filters]
  end

  if attributes.key?(:tag_filters)
    self.tag_filters = attributes[:tag_filters]
  end

  if attributes.key?(:sum_or_filters_scores)
    self.sum_or_filters_scores = attributes[:sum_or_filters_scores]
  end

  if attributes.key?(:restrict_searchable_attributes)
    if (value = attributes[:restrict_searchable_attributes]).is_a?(Array)
      self.restrict_searchable_attributes = value
    end
  end

  if attributes.key?(:facets)
    if (value = attributes[:facets]).is_a?(Array)
      self.facets = value
    end
  end

  if attributes.key?(:faceting_after_distinct)
    self.faceting_after_distinct = attributes[:faceting_after_distinct]
  end

  if attributes.key?(:page)
    self.page = attributes[:page]
  end

  if attributes.key?(:offset)
    self.offset = attributes[:offset]
  end

  if attributes.key?(:length)
    self.length = attributes[:length]
  end

  if attributes.key?(:around_lat_lng)
    self.around_lat_lng = attributes[:around_lat_lng]
  end

  if attributes.key?(:around_lat_lng_via_ip)
    self.around_lat_lng_via_ip = attributes[:around_lat_lng_via_ip]
  end

  if attributes.key?(:around_radius)
    self.around_radius = attributes[:around_radius]
  end

  if attributes.key?(:around_precision)
    self.around_precision = attributes[:around_precision]
  end

  if attributes.key?(:minimum_around_radius)
    self.minimum_around_radius = attributes[:minimum_around_radius]
  end

  if attributes.key?(:inside_bounding_box)
    if (value = attributes[:inside_bounding_box]).is_a?(Array)
      self.inside_bounding_box = value
    end
  end

  if attributes.key?(:inside_polygon)
    if (value = attributes[:inside_polygon]).is_a?(Array)
      self.inside_polygon = value
    end
  end

  if attributes.key?(:natural_languages)
    if (value = attributes[:natural_languages]).is_a?(Array)
      self.natural_languages = value
    end
  end

  if attributes.key?(:rule_contexts)
    if (value = attributes[:rule_contexts]).is_a?(Array)
      self.rule_contexts = value
    end
  end

  if attributes.key?(:personalization_impact)
    self.personalization_impact = attributes[:personalization_impact]
  end

  if attributes.key?(:user_token)
    self.user_token = attributes[:user_token]
  end

  if attributes.key?(:get_ranking_info)
    self.get_ranking_info = attributes[:get_ranking_info]
  end

  if attributes.key?(:synonyms)
    self.synonyms = attributes[:synonyms]
  end

  if attributes.key?(:click_analytics)
    self.click_analytics = attributes[:click_analytics]
  end

  if attributes.key?(:analytics)
    self.analytics = attributes[:analytics]
  end

  if attributes.key?(:analytics_tags)
    if (value = attributes[:analytics_tags]).is_a?(Array)
      self.analytics_tags = value
    end
  end

  if attributes.key?(:percentile_computation)
    self.percentile_computation = attributes[:percentile_computation]
  end

  if attributes.key?(:enable_ab_test)
    self.enable_ab_test = attributes[:enable_ab_test]
  end
end

Instance Attribute Details

#analyticsObject

Whether this search will be included in Analytics.



88
89
90
# File 'lib/algolia/models/search/base_search_params.rb', line 88

def analytics
  @analytics
end

#analytics_tagsObject

Tags to apply to the query for [segmenting analytics data](www.algolia.com/doc/guides/search-analytics/guides/segments/).



91
92
93
# File 'lib/algolia/models/search/base_search_params.rb', line 91

def analytics_tags
  @analytics_tags
end

#around_lat_lngObject

Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude. Only records included within circle around this central location are included in the results. The radius of the circle is determined by the ‘aroundRadius` and `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` or `insideBoundingBox`.



48
49
50
# File 'lib/algolia/models/search/base_search_params.rb', line 48

def around_lat_lng
  @around_lat_lng
end

#around_lat_lng_via_ipObject

Whether to obtain the coordinates from the request’s IP address.



51
52
53
# File 'lib/algolia/models/search/base_search_params.rb', line 51

def around_lat_lng_via_ip
  @around_lat_lng_via_ip
end

#around_precisionObject

Returns the value of attribute around_precision.



55
56
57
# File 'lib/algolia/models/search/base_search_params.rb', line 55

def around_precision
  @around_precision
end

#around_radiusObject

Returns the value of attribute around_radius.



53
54
55
# File 'lib/algolia/models/search/base_search_params.rb', line 53

def around_radius
  @around_radius
end

#click_analyticsObject

Whether to include a ‘queryID` attribute in the response. The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](www.algolia.com/guides/sending-events/getting-started/).



85
86
87
# File 'lib/algolia/models/search/base_search_params.rb', line 85

def click_analytics
  @click_analytics
end

#enable_ab_testObject

Whether to enable A/B testing for this search.



97
98
99
# File 'lib/algolia/models/search/base_search_params.rb', line 97

def enable_ab_test
  @enable_ab_test
end

#facet_filtersObject

Returns the value of attribute facet_filters.



18
19
20
# File 'lib/algolia/models/search/base_search_params.rb', line 18

def facet_filters
  @facet_filters
end

#faceting_after_distinctObject

Whether faceting should be applied after deduplication with ‘distinct`. This leads to accurate facet counts when using faceting in combination with `distinct`. It’s usually better to use ‘afterDistinct` modifiers in the `attributesForFaceting` setting, as `facetingAfterDistinct` only computes correct facet counts if all records have the same facet values for the `attributeForDistinct`.



36
37
38
# File 'lib/algolia/models/search/base_search_params.rb', line 36

def faceting_after_distinct
  @faceting_after_distinct
end

#facetsObject

Facets for which to retrieve facet values that match the search criteria and the number of matching facet values. To retrieve all facets, use the wildcard character ‘*`. For more information, see [facets](www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts).



33
34
35
# File 'lib/algolia/models/search/base_search_params.rb', line 33

def facets
  @facets
end

#filtersObject

Filter the search so that only records with matching values are included in the results. These filters are supported: - **Numeric filters.** ‘<facet> <op> <number>`, where `<op>` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - Ranges. `<facet>:<lower> TO <upper>` where `<lower>` and `<upper>` are the lower and upper limits of the range (inclusive). - **Facet filters.** `<facet>:<value>` where `<facet>` is a facet attribute (case-sensitive) and `<value>` a facet value. - **Tag filters.** `_tags:<value>` or just `<value>` (case-sensitive). - **Boolean filters.** `<facet>: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can’t use ‘NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can’t combine conjunctions (‘AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](www.algolia.com/doc/guides/managing-results/refine-results/filtering/).



16
17
18
# File 'lib/algolia/models/search/base_search_params.rb', line 16

def filters
  @filters
end

#get_ranking_infoObject

Whether the search response should include detailed ranking information.



79
80
81
# File 'lib/algolia/models/search/base_search_params.rb', line 79

def get_ranking_info
  @get_ranking_info
end

#inside_bounding_boxObject

Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: ‘[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).



61
62
63
# File 'lib/algolia/models/search/base_search_params.rb', line 61

def inside_bounding_box
  @inside_bounding_box
end

#inside_polygonObject

Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored, if you also specify ‘insideBoundingBox`.



64
65
66
# File 'lib/algolia/models/search/base_search_params.rb', line 64

def inside_polygon
  @inside_polygon
end

#lengthObject

Number of hits to retrieve (used in combination with ‘offset`).



45
46
47
# File 'lib/algolia/models/search/base_search_params.rb', line 45

def length
  @length
end

#minimum_around_radiusObject

Minimum radius (in meters) for a search around a location when ‘aroundRadius` isn’t set.



58
59
60
# File 'lib/algolia/models/search/base_search_params.rb', line 58

def minimum_around_radius
  @minimum_around_radius
end

#natural_languagesObject

ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches): - Sets ‘removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`.



67
68
69
# File 'lib/algolia/models/search/base_search_params.rb', line 67

def natural_languages
  @natural_languages
end

#numeric_filtersObject

Returns the value of attribute numeric_filters.



22
23
24
# File 'lib/algolia/models/search/base_search_params.rb', line 22

def numeric_filters
  @numeric_filters
end

#offsetObject

Position of the first hit to retrieve.



42
43
44
# File 'lib/algolia/models/search/base_search_params.rb', line 42

def offset
  @offset
end

#optional_filtersObject

Returns the value of attribute optional_filters.



20
21
22
# File 'lib/algolia/models/search/base_search_params.rb', line 20

def optional_filters
  @optional_filters
end

#pageObject

Page of search results to retrieve.



39
40
41
# File 'lib/algolia/models/search/base_search_params.rb', line 39

def page
  @page
end

#percentile_computationObject

Whether to include this search when calculating processing-time percentiles.



94
95
96
# File 'lib/algolia/models/search/base_search_params.rb', line 94

def percentile_computation
  @percentile_computation
end

#personalization_impactObject

Impact that Personalization should have on this search. The higher this value is, the more Personalization determines the ranking compared to other factors. For more information, see [Understanding Personalization impact](www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact).



73
74
75
# File 'lib/algolia/models/search/base_search_params.rb', line 73

def personalization_impact
  @personalization_impact
end

#queryObject

Search query.



10
11
12
# File 'lib/algolia/models/search/base_search_params.rb', line 10

def query
  @query
end

#restrict_searchable_attributesObject

Restricts a search to a subset of your searchable attributes.



30
31
32
# File 'lib/algolia/models/search/base_search_params.rb', line 30

def restrict_searchable_attributes
  @restrict_searchable_attributes
end

#rule_contextsObject

Assigns a rule context to the search query. [Rule contexts](www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules.



70
71
72
# File 'lib/algolia/models/search/base_search_params.rb', line 70

def rule_contexts
  @rule_contexts
end

#similar_queryObject

Keywords to be used instead of the search query to conduct a more broader search. Using the ‘similarQuery` parameter changes other settings: - `queryType` is set to `prefixNone`. - `removeStopWords` is set to true. - `words` is set as the first ranking criterion. - All remaining words are treated as `optionalWords`. Since the `similarQuery` is supposed to do a broad search, they usually return many results. Combine it with `filters` to narrow down the list of results.



13
14
15
# File 'lib/algolia/models/search/base_search_params.rb', line 13

def similar_query
  @similar_query
end

#sum_or_filters_scoresObject

Whether to sum all filter scores. If true, all filter scores are summed. Otherwise, the maximum filter score is kept. For more information, see [filter scores](www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores).



27
28
29
# File 'lib/algolia/models/search/base_search_params.rb', line 27

def sum_or_filters_scores
  @sum_or_filters_scores
end

#synonymsObject

Whether to take into account an index’s synonyms for this search.



82
83
84
# File 'lib/algolia/models/search/base_search_params.rb', line 82

def synonyms
  @synonyms
end

#tag_filtersObject

Returns the value of attribute tag_filters.



24
25
26
# File 'lib/algolia/models/search/base_search_params.rb', line 24

def tag_filters
  @tag_filters
end

#user_tokenObject

Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](www.algolia.com/doc/guides/sending-events/concepts/usertoken/).



76
77
78
# File 'lib/algolia/models/search/base_search_params.rb', line 76

def user_token
  @user_token
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/algolia/models/search/base_search_params.rb', line 498

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_attributesObject

Returns all the JSON keys this model knows about



138
139
140
# File 'lib/algolia/models/search/base_search_params.rb', line 138

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
134
135
# File 'lib/algolia/models/search/base_search_params.rb', line 100

def self.attribute_map
  {
    :query => :query,
    :similar_query => :similarQuery,
    :filters => :filters,
    :facet_filters => :facetFilters,
    :optional_filters => :optionalFilters,
    :numeric_filters => :numericFilters,
    :tag_filters => :tagFilters,
    :sum_or_filters_scores => :sumOrFiltersScores,
    :restrict_searchable_attributes => :restrictSearchableAttributes,
    :facets => :facets,
    :faceting_after_distinct => :facetingAfterDistinct,
    :page => :page,
    :offset => :offset,
    :length => :length,
    :around_lat_lng => :aroundLatLng,
    :around_lat_lng_via_ip => :aroundLatLngViaIP,
    :around_radius => :aroundRadius,
    :around_precision => :aroundPrecision,
    :minimum_around_radius => :minimumAroundRadius,
    :inside_bounding_box => :insideBoundingBox,
    :inside_polygon => :insidePolygon,
    :natural_languages => :naturalLanguages,
    :rule_contexts => :ruleContexts,
    :personalization_impact => :personalizationImpact,
    :user_token => :userToken,
    :get_ranking_info => :getRankingInfo,
    :synonyms => :synonyms,
    :click_analytics => :clickAnalytics,
    :analytics => :analytics,
    :analytics_tags => :analyticsTags,
    :percentile_computation => :percentileComputation,
    :enable_ab_test => :enableABTest
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/algolia/models/search/base_search_params.rb', line 473

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_sym] = 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_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



186
187
188
189
190
191
# File 'lib/algolia/models/search/base_search_params.rb', line 186

def self.openapi_all_of
  [
    :BaseSearchParamsWithoutQuery,
    :SearchParamsQuery
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



181
182
183
# File 'lib/algolia/models/search/base_search_params.rb', line 181

def self.openapi_nullable
  Set.new([])
end

.types_mappingObject

Attribute type mapping.



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
176
177
178
# File 'lib/algolia/models/search/base_search_params.rb', line 143

def self.types_mapping
  {
    :query => :String,
    :similar_query => :String,
    :filters => :String,
    :facet_filters => :FacetFilters,
    :optional_filters => :OptionalFilters,
    :numeric_filters => :NumericFilters,
    :tag_filters => :TagFilters,
    :sum_or_filters_scores => :Boolean,
    :restrict_searchable_attributes => :'Array<String>',
    :facets => :'Array<String>',
    :faceting_after_distinct => :Boolean,
    :page => :Integer,
    :offset => :Integer,
    :length => :Integer,
    :around_lat_lng => :String,
    :around_lat_lng_via_ip => :Boolean,
    :around_radius => :AroundRadius,
    :around_precision => :AroundPrecision,
    :minimum_around_radius => :Integer,
    :inside_bounding_box => :'Array<Array<Float>>',
    :inside_polygon => :'Array<Array<Float>>',
    :natural_languages => :'Array<String>',
    :rule_contexts => :'Array<String>',
    :personalization_impact => :Integer,
    :user_token => :String,
    :get_ranking_info => :Boolean,
    :synonyms => :Boolean,
    :click_analytics => :Boolean,
    :analytics => :Boolean,
    :analytics_tags => :'Array<String>',
    :percentile_computation => :Boolean,
    :enable_ab_test => :Boolean
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/algolia/models/search/base_search_params.rb', line 419

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    query == other.query &&
    similar_query == other.similar_query &&
    filters == other.filters &&
    facet_filters == other.facet_filters &&
    optional_filters == other.optional_filters &&
    numeric_filters == other.numeric_filters &&
    tag_filters == other.tag_filters &&
    sum_or_filters_scores == other.sum_or_filters_scores &&
    restrict_searchable_attributes == other.restrict_searchable_attributes &&
    facets == other.facets &&
    faceting_after_distinct == other.faceting_after_distinct &&
    page == other.page &&
    offset == other.offset &&
    length == other.length &&
    around_lat_lng == other.around_lat_lng &&
    around_lat_lng_via_ip == other.around_lat_lng_via_ip &&
    around_radius == other.around_radius &&
    around_precision == other.around_precision &&
    minimum_around_radius == other.minimum_around_radius &&
    inside_bounding_box == other.inside_bounding_box &&
    inside_polygon == other.inside_polygon &&
    natural_languages == other.natural_languages &&
    rule_contexts == other.rule_contexts &&
    personalization_impact == other.personalization_impact &&
    user_token == other.user_token &&
    get_ranking_info == other.get_ranking_info &&
    synonyms == other.synonyms &&
    click_analytics == other.click_analytics &&
    analytics == other.analytics &&
    analytics_tags == other.analytics_tags &&
    percentile_computation == other.percentile_computation &&
    enable_ab_test == other.enable_ab_test
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



573
574
575
576
577
578
579
580
581
582
583
584
585
# File 'lib/algolia/models/search/base_search_params.rb', line 573

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


459
460
461
# File 'lib/algolia/models/search/base_search_params.rb', line 459

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



465
466
467
468
# File 'lib/algolia/models/search/base_search_params.rb', line 465

def hash
  [query, similar_query, filters, facet_filters, optional_filters, numeric_filters, tag_filters, sum_or_filters_scores, restrict_searchable_attributes, facets,
   faceting_after_distinct, page, offset, length, around_lat_lng, around_lat_lng_via_ip, around_radius, around_precision, minimum_around_radius, inside_bounding_box, inside_polygon, natural_languages, rule_contexts, personalization_impact, user_token, get_ranking_info, synonyms, click_analytics, analytics, analytics_tags, percentile_computation, enable_ab_test].hash
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



545
546
547
# File 'lib/algolia/models/search/base_search_params.rb', line 545

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/algolia/models/search/base_search_params.rb', line 555

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_json(*_args) ⇒ Object



549
550
551
# File 'lib/algolia/models/search/base_search_params.rb', line 549

def to_json(*_args)
  to_hash.to_json
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



539
540
541
# File 'lib/algolia/models/search/base_search_params.rb', line 539

def to_s
  to_hash.to_s
end