algolia 3.8.0 → 3.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,7 +57,6 @@ module Algolia
57
57
  # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set.
58
58
  attr_accessor :minimum_around_radius
59
59
 
60
- # 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](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
61
60
  attr_accessor :inside_bounding_box
62
61
 
63
62
  # 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](https://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`.
@@ -173,7 +172,6 @@ module Algolia
173
172
  # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
174
173
  attr_accessor :advanced_syntax
175
174
 
176
- # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words).
177
175
  attr_accessor :optional_words
178
176
 
179
177
  # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking.
@@ -198,9 +196,6 @@ module Algolia
198
196
  # Properties to include in the API response of `search` and `browse` requests. By default, all response properties are included. To reduce the response size, you can select, which attributes should be included. You can't exclude these properties: `message`, `warning`, `cursor`, `serverUsed`, `indexUsed`, `abTestVariantID`, `parsedQuery`, or any property triggered by the `getRankingInfo` parameter. Don't exclude properties that you might need in your search UI.
199
197
  attr_accessor :response_fields
200
198
 
201
- # Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
202
- attr_accessor :max_facet_hits
203
-
204
199
  # Maximum number of facet values to return for each facet.
205
200
  attr_accessor :max_values_per_facet
206
201
 
@@ -292,7 +287,6 @@ module Algolia
292
287
  :replace_synonyms_in_highlight => :replaceSynonymsInHighlight,
293
288
  :min_proximity => :minProximity,
294
289
  :response_fields => :responseFields,
295
- :max_facet_hits => :maxFacetHits,
296
290
  :max_values_per_facet => :maxValuesPerFacet,
297
291
  :sort_facet_values_by => :sortFacetValuesBy,
298
292
  :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity,
@@ -330,7 +324,7 @@ module Algolia
330
324
  :around_radius => :"AroundRadius",
331
325
  :around_precision => :"AroundPrecision",
332
326
  :minimum_around_radius => :"Integer",
333
- :inside_bounding_box => :"Array<Array<Float>>",
327
+ :inside_bounding_box => :"InsideBoundingBox",
334
328
  :inside_polygon => :"Array<Array<Float>>",
335
329
  :natural_languages => :"Array<SupportedLanguage>",
336
330
  :rule_contexts => :"Array<String>",
@@ -371,7 +365,7 @@ module Algolia
371
365
  :mode => :"Mode",
372
366
  :semantic_search => :"SemanticSearch",
373
367
  :advanced_syntax => :"Boolean",
374
- :optional_words => :"Array<String>",
368
+ :optional_words => :"OptionalWords",
375
369
  :disable_exact_on_attributes => :"Array<String>",
376
370
  :exact_on_single_word_query => :"ExactOnSingleWordQuery",
377
371
  :alternatives_as_exact => :"Array<AlternativesAsExact>",
@@ -380,7 +374,6 @@ module Algolia
380
374
  :replace_synonyms_in_highlight => :"Boolean",
381
375
  :min_proximity => :"Integer",
382
376
  :response_fields => :"Array<String>",
383
- :max_facet_hits => :"Integer",
384
377
  :max_values_per_facet => :"Integer",
385
378
  :sort_facet_values_by => :"String",
386
379
  :attribute_criteria_computed_by_min_proximity => :"Boolean",
@@ -394,7 +387,10 @@ module Algolia
394
387
  # List of attributes with nullable: true
395
388
  def self.openapi_nullable
396
389
  Set.new(
397
- []
390
+ [
391
+ :inside_bounding_box,
392
+ :optional_words
393
+ ]
398
394
  )
399
395
  end
400
396
 
@@ -510,9 +506,7 @@ module Algolia
510
506
  end
511
507
 
512
508
  if attributes.key?(:inside_bounding_box)
513
- if (value = attributes[:inside_bounding_box]).is_a?(Array)
514
- self.inside_bounding_box = value
515
- end
509
+ self.inside_bounding_box = attributes[:inside_bounding_box]
516
510
  end
517
511
 
518
512
  if attributes.key?(:inside_polygon)
@@ -698,9 +692,7 @@ module Algolia
698
692
  end
699
693
 
700
694
  if attributes.key?(:optional_words)
701
- if (value = attributes[:optional_words]).is_a?(Array)
702
- self.optional_words = value
703
- end
695
+ self.optional_words = attributes[:optional_words]
704
696
  end
705
697
 
706
698
  if attributes.key?(:disable_exact_on_attributes)
@@ -743,10 +735,6 @@ module Algolia
743
735
  end
744
736
  end
745
737
 
746
- if attributes.key?(:max_facet_hits)
747
- self.max_facet_hits = attributes[:max_facet_hits]
748
- end
749
-
750
738
  if attributes.key?(:max_values_per_facet)
751
739
  self.max_values_per_facet = attributes[:max_values_per_facet]
752
740
  end
@@ -850,7 +838,6 @@ module Algolia
850
838
  replace_synonyms_in_highlight == other.replace_synonyms_in_highlight &&
851
839
  min_proximity == other.min_proximity &&
852
840
  response_fields == other.response_fields &&
853
- max_facet_hits == other.max_facet_hits &&
854
841
  max_values_per_facet == other.max_values_per_facet &&
855
842
  sort_facet_values_by == other.sort_facet_values_by &&
856
843
  attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity &&
@@ -939,7 +926,6 @@ module Algolia
939
926
  replace_synonyms_in_highlight,
940
927
  min_proximity,
941
928
  response_fields,
942
- max_facet_hits,
943
929
  max_values_per_facet,
944
930
  sort_facet_values_by,
945
931
  attribute_criteria_computed_by_min_proximity,
@@ -54,7 +54,6 @@ module Algolia
54
54
  # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set.
55
55
  attr_accessor :minimum_around_radius
56
56
 
57
- # 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](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
58
57
  attr_accessor :inside_bounding_box
59
58
 
60
59
  # 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](https://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`.
@@ -170,7 +169,6 @@ module Algolia
170
169
  # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
171
170
  attr_accessor :advanced_syntax
172
171
 
173
- # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words).
174
172
  attr_accessor :optional_words
175
173
 
176
174
  # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking.
@@ -195,9 +193,6 @@ module Algolia
195
193
  # Properties to include in the API response of `search` and `browse` requests. By default, all response properties are included. To reduce the response size, you can select, which attributes should be included. You can't exclude these properties: `message`, `warning`, `cursor`, `serverUsed`, `indexUsed`, `abTestVariantID`, `parsedQuery`, or any property triggered by the `getRankingInfo` parameter. Don't exclude properties that you might need in your search UI.
196
194
  attr_accessor :response_fields
197
195
 
198
- # Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
199
- attr_accessor :max_facet_hits
200
-
201
196
  # Maximum number of facet values to return for each facet.
202
197
  attr_accessor :max_values_per_facet
203
198
 
@@ -291,7 +286,6 @@ module Algolia
291
286
  :replace_synonyms_in_highlight => :replaceSynonymsInHighlight,
292
287
  :min_proximity => :minProximity,
293
288
  :response_fields => :responseFields,
294
- :max_facet_hits => :maxFacetHits,
295
289
  :max_values_per_facet => :maxValuesPerFacet,
296
290
  :sort_facet_values_by => :sortFacetValuesBy,
297
291
  :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity,
@@ -330,7 +324,7 @@ module Algolia
330
324
  :around_radius => :"AroundRadius",
331
325
  :around_precision => :"AroundPrecision",
332
326
  :minimum_around_radius => :"Integer",
333
- :inside_bounding_box => :"Array<Array<Float>>",
327
+ :inside_bounding_box => :"InsideBoundingBox",
334
328
  :inside_polygon => :"Array<Array<Float>>",
335
329
  :natural_languages => :"Array<SupportedLanguage>",
336
330
  :rule_contexts => :"Array<String>",
@@ -371,7 +365,7 @@ module Algolia
371
365
  :mode => :"Mode",
372
366
  :semantic_search => :"SemanticSearch",
373
367
  :advanced_syntax => :"Boolean",
374
- :optional_words => :"Array<String>",
368
+ :optional_words => :"OptionalWords",
375
369
  :disable_exact_on_attributes => :"Array<String>",
376
370
  :exact_on_single_word_query => :"ExactOnSingleWordQuery",
377
371
  :alternatives_as_exact => :"Array<AlternativesAsExact>",
@@ -380,7 +374,6 @@ module Algolia
380
374
  :replace_synonyms_in_highlight => :"Boolean",
381
375
  :min_proximity => :"Integer",
382
376
  :response_fields => :"Array<String>",
383
- :max_facet_hits => :"Integer",
384
377
  :max_values_per_facet => :"Integer",
385
378
  :sort_facet_values_by => :"String",
386
379
  :attribute_criteria_computed_by_min_proximity => :"Boolean",
@@ -396,7 +389,10 @@ module Algolia
396
389
  # List of attributes with nullable: true
397
390
  def self.openapi_nullable
398
391
  Set.new(
399
- []
392
+ [
393
+ :inside_bounding_box,
394
+ :optional_words
395
+ ]
400
396
  )
401
397
  end
402
398
 
@@ -509,9 +505,7 @@ module Algolia
509
505
  end
510
506
 
511
507
  if attributes.key?(:inside_bounding_box)
512
- if (value = attributes[:inside_bounding_box]).is_a?(Array)
513
- self.inside_bounding_box = value
514
- end
508
+ self.inside_bounding_box = attributes[:inside_bounding_box]
515
509
  end
516
510
 
517
511
  if attributes.key?(:inside_polygon)
@@ -697,9 +691,7 @@ module Algolia
697
691
  end
698
692
 
699
693
  if attributes.key?(:optional_words)
700
- if (value = attributes[:optional_words]).is_a?(Array)
701
- self.optional_words = value
702
- end
694
+ self.optional_words = attributes[:optional_words]
703
695
  end
704
696
 
705
697
  if attributes.key?(:disable_exact_on_attributes)
@@ -742,10 +734,6 @@ module Algolia
742
734
  end
743
735
  end
744
736
 
745
- if attributes.key?(:max_facet_hits)
746
- self.max_facet_hits = attributes[:max_facet_hits]
747
- end
748
-
749
737
  if attributes.key?(:max_values_per_facet)
750
738
  self.max_values_per_facet = attributes[:max_values_per_facet]
751
739
  end
@@ -856,7 +844,6 @@ module Algolia
856
844
  replace_synonyms_in_highlight == other.replace_synonyms_in_highlight &&
857
845
  min_proximity == other.min_proximity &&
858
846
  response_fields == other.response_fields &&
859
- max_facet_hits == other.max_facet_hits &&
860
847
  max_values_per_facet == other.max_values_per_facet &&
861
848
  sort_facet_values_by == other.sort_facet_values_by &&
862
849
  attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity &&
@@ -946,7 +933,6 @@ module Algolia
946
933
  replace_synonyms_in_highlight,
947
934
  min_proximity,
948
935
  response_fields,
949
- max_facet_hits,
950
936
  max_values_per_facet,
951
937
  sort_facet_values_by,
952
938
  attribute_criteria_computed_by_min_proximity,
@@ -20,7 +20,6 @@ module Algolia
20
20
 
21
21
  attr_accessor :around_radius
22
22
 
23
- # 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](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
24
23
  attr_accessor :inside_bounding_box
25
24
 
26
25
  # 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](https://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`.
@@ -54,7 +53,7 @@ module Algolia
54
53
  :tag_filters => :"TagFilters",
55
54
  :around_lat_lng => :"String",
56
55
  :around_radius => :"AroundRadius",
57
- :inside_bounding_box => :"Array<Array<Float>>",
56
+ :inside_bounding_box => :"InsideBoundingBox",
58
57
  :inside_polygon => :"Array<Array<Float>>"
59
58
  }
60
59
  end
@@ -62,7 +61,9 @@ module Algolia
62
61
  # List of attributes with nullable: true
63
62
  def self.openapi_nullable
64
63
  Set.new(
65
- []
64
+ [
65
+ :inside_bounding_box
66
+ ]
66
67
  )
67
68
  end
68
69
 
@@ -114,9 +115,7 @@ module Algolia
114
115
  end
115
116
 
116
117
  if attributes.key?(:inside_bounding_box)
117
- if (value = attributes[:inside_bounding_box]).is_a?(Array)
118
- self.inside_bounding_box = value
119
- end
118
+ self.inside_bounding_box = attributes[:inside_bounding_box]
120
119
  end
121
120
 
122
121
  if attributes.key?(:inside_polygon)
@@ -58,6 +58,9 @@ module Algolia
58
58
  # Attribute that should be used to establish groups of results. Attribute names are case-sensitive. All records with the same value for this attribute are considered a group. You can combine `attributeForDistinct` with the `distinct` search parameter to control how many items per group are included in the search results. If you want to use the same attribute also for faceting, use the `afterDistinct` modifier of the `attributesForFaceting` setting. This applies faceting _after_ deduplication, which will result in accurate facet counts.
59
59
  attr_accessor :attribute_for_distinct
60
60
 
61
+ # Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
62
+ attr_accessor :max_facet_hits
63
+
61
64
  # Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. Attribute names are case-sensitive. - `*` retrieves all attributes, except attributes included in the `customRanking` and `unretrievableAttributes` settings. - To retrieve all attributes except a specific one, prefix the attribute with a dash and combine it with the `*`: `[\"*\", \"-ATTRIBUTE\"]`. - The `objectID` attribute is always included.
62
65
  attr_accessor :attributes_to_retrieve
63
66
 
@@ -135,7 +138,6 @@ module Algolia
135
138
  # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
136
139
  attr_accessor :advanced_syntax
137
140
 
138
- # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words).
139
141
  attr_accessor :optional_words
140
142
 
141
143
  # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking.
@@ -160,9 +162,6 @@ module Algolia
160
162
  # Properties to include in the API response of `search` and `browse` requests. By default, all response properties are included. To reduce the response size, you can select, which attributes should be included. You can't exclude these properties: `message`, `warning`, `cursor`, `serverUsed`, `indexUsed`, `abTestVariantID`, `parsedQuery`, or any property triggered by the `getRankingInfo` parameter. Don't exclude properties that you might need in your search UI.
161
163
  attr_accessor :response_fields
162
164
 
163
- # Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
164
- attr_accessor :max_facet_hits
165
-
166
165
  # Maximum number of facet values to return for each facet.
167
166
  attr_accessor :max_values_per_facet
168
167
 
@@ -199,6 +198,7 @@ module Algolia
199
198
  :user_data => :userData,
200
199
  :custom_normalization => :customNormalization,
201
200
  :attribute_for_distinct => :attributeForDistinct,
201
+ :max_facet_hits => :maxFacetHits,
202
202
  :attributes_to_retrieve => :attributesToRetrieve,
203
203
  :ranking => :ranking,
204
204
  :custom_ranking => :customRanking,
@@ -236,7 +236,6 @@ module Algolia
236
236
  :replace_synonyms_in_highlight => :replaceSynonymsInHighlight,
237
237
  :min_proximity => :minProximity,
238
238
  :response_fields => :responseFields,
239
- :max_facet_hits => :maxFacetHits,
240
239
  :max_values_per_facet => :maxValuesPerFacet,
241
240
  :sort_facet_values_by => :sortFacetValuesBy,
242
241
  :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity,
@@ -271,6 +270,7 @@ module Algolia
271
270
  :user_data => :"Object",
272
271
  :custom_normalization => :"Hash<String, Hash<String, String>>",
273
272
  :attribute_for_distinct => :"String",
273
+ :max_facet_hits => :"Integer",
274
274
  :attributes_to_retrieve => :"Array<String>",
275
275
  :ranking => :"Array<String>",
276
276
  :custom_ranking => :"Array<String>",
@@ -299,7 +299,7 @@ module Algolia
299
299
  :mode => :"Mode",
300
300
  :semantic_search => :"SemanticSearch",
301
301
  :advanced_syntax => :"Boolean",
302
- :optional_words => :"Array<String>",
302
+ :optional_words => :"OptionalWords",
303
303
  :disable_exact_on_attributes => :"Array<String>",
304
304
  :exact_on_single_word_query => :"ExactOnSingleWordQuery",
305
305
  :alternatives_as_exact => :"Array<AlternativesAsExact>",
@@ -308,7 +308,6 @@ module Algolia
308
308
  :replace_synonyms_in_highlight => :"Boolean",
309
309
  :min_proximity => :"Integer",
310
310
  :response_fields => :"Array<String>",
311
- :max_facet_hits => :"Integer",
312
311
  :max_values_per_facet => :"Integer",
313
312
  :sort_facet_values_by => :"String",
314
313
  :attribute_criteria_computed_by_min_proximity => :"Boolean",
@@ -321,7 +320,9 @@ module Algolia
321
320
  # List of attributes with nullable: true
322
321
  def self.openapi_nullable
323
322
  Set.new(
324
- []
323
+ [
324
+ :optional_words
325
+ ]
325
326
  )
326
327
  end
327
328
 
@@ -446,6 +447,10 @@ module Algolia
446
447
  self.attribute_for_distinct = attributes[:attribute_for_distinct]
447
448
  end
448
449
 
450
+ if attributes.key?(:max_facet_hits)
451
+ self.max_facet_hits = attributes[:max_facet_hits]
452
+ end
453
+
449
454
  if attributes.key?(:attributes_to_retrieve)
450
455
  if (value = attributes[:attributes_to_retrieve]).is_a?(Array)
451
456
  self.attributes_to_retrieve = value
@@ -573,9 +578,7 @@ module Algolia
573
578
  end
574
579
 
575
580
  if attributes.key?(:optional_words)
576
- if (value = attributes[:optional_words]).is_a?(Array)
577
- self.optional_words = value
578
- end
581
+ self.optional_words = attributes[:optional_words]
579
582
  end
580
583
 
581
584
  if attributes.key?(:disable_exact_on_attributes)
@@ -618,10 +621,6 @@ module Algolia
618
621
  end
619
622
  end
620
623
 
621
- if attributes.key?(:max_facet_hits)
622
- self.max_facet_hits = attributes[:max_facet_hits]
623
- end
624
-
625
624
  if attributes.key?(:max_values_per_facet)
626
625
  self.max_values_per_facet = attributes[:max_values_per_facet]
627
626
  end
@@ -669,6 +668,7 @@ module Algolia
669
668
  user_data == other.user_data &&
670
669
  custom_normalization == other.custom_normalization &&
671
670
  attribute_for_distinct == other.attribute_for_distinct &&
671
+ max_facet_hits == other.max_facet_hits &&
672
672
  attributes_to_retrieve == other.attributes_to_retrieve &&
673
673
  ranking == other.ranking &&
674
674
  custom_ranking == other.custom_ranking &&
@@ -706,7 +706,6 @@ module Algolia
706
706
  replace_synonyms_in_highlight == other.replace_synonyms_in_highlight &&
707
707
  min_proximity == other.min_proximity &&
708
708
  response_fields == other.response_fields &&
709
- max_facet_hits == other.max_facet_hits &&
710
709
  max_values_per_facet == other.max_values_per_facet &&
711
710
  sort_facet_values_by == other.sort_facet_values_by &&
712
711
  attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity &&
@@ -742,6 +741,7 @@ module Algolia
742
741
  user_data,
743
742
  custom_normalization,
744
743
  attribute_for_distinct,
744
+ max_facet_hits,
745
745
  attributes_to_retrieve,
746
746
  ranking,
747
747
  custom_ranking,
@@ -779,7 +779,6 @@ module Algolia
779
779
  replace_synonyms_in_highlight,
780
780
  min_proximity,
781
781
  response_fields,
782
- max_facet_hits,
783
782
  max_values_per_facet,
784
783
  sort_facet_values_by,
785
784
  attribute_criteria_computed_by_min_proximity,
@@ -0,0 +1,108 @@
1
+ # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2
+
3
+ require "date"
4
+ require "time"
5
+
6
+ module Algolia
7
+ module Search
8
+ module InsideBoundingBox
9
+ class << self
10
+ # List of class defined in oneOf (OpenAPI v3)
11
+ def openapi_one_of
12
+ [
13
+ :"Array<Array<Float>>",
14
+ :"String"
15
+ ]
16
+ end
17
+
18
+ # Builds the object
19
+ # @param [Mixed] Data to be matched against the list of oneOf items
20
+ # @return [Object] Returns the model or the data itself
21
+ def build(data)
22
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
23
+ # Note:
24
+ # - We do not attempt to check whether exactly one item matches.
25
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
26
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
27
+ # - TODO: scalar values are de facto behaving as if they were nullable.
28
+ # - TODO: logging when debugging is set.
29
+ openapi_one_of.each do |klass|
30
+ begin
31
+ # "nullable: true"
32
+ next if klass == :AnyType
33
+ typed_data = find_and_cast_into_type(klass, data)
34
+ return typed_data if typed_data
35
+ # rescue all errors so we keep iterating even if the current item lookup raises
36
+ rescue
37
+ end
38
+ end
39
+
40
+ openapi_one_of.include?(:AnyType) ? data : nil
41
+ end
42
+
43
+ private
44
+
45
+ SchemaMismatchError = Class.new(StandardError)
46
+
47
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
48
+ def find_and_cast_into_type(klass, data)
49
+ return if data.nil?
50
+
51
+ case klass.to_s
52
+ when "Boolean"
53
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
54
+ when "Float"
55
+ return data if data.instance_of?(Float)
56
+ when "Integer"
57
+ return data if data.instance_of?(Integer)
58
+ when "Time"
59
+ return Time.parse(data)
60
+ when "Date"
61
+ return Date.parse(data)
62
+ when "String"
63
+ return data if data.instance_of?(String)
64
+ # "type: object"
65
+ when "Object"
66
+ return data if data.instance_of?(Hash)
67
+ # "type: array"
68
+ when /\AArray<(?<sub_type>.+)>\z/
69
+ if data.instance_of?(Array)
70
+ sub_type = Regexp.last_match[:sub_type]
71
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
72
+ end
73
+ # "type: object" with "additionalProperties: { ... }"
74
+ when /\AHash<String, (?<sub_type>.+)>\z/
75
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
76
+ sub_type = Regexp.last_match[:sub_type]
77
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
78
+ end
79
+ # model
80
+ else
81
+ const = Algolia::Search.const_get(klass)
82
+ if const
83
+ if const.respond_to?(:openapi_one_of)
84
+ # nested oneOf model
85
+ model = const.build(data)
86
+ elsif const.respond_to?(:acceptable_attributes)
87
+ # raise if data contains keys that are not known to the model
88
+ raise unless (data.keys - const.acceptable_attributes).empty?
89
+ model = const.build_from_hash(data)
90
+ else
91
+ # maybe it's an enum
92
+ model = const.build_from_hash(data)
93
+ end
94
+
95
+ return model if model
96
+ end
97
+ end
98
+
99
+ # if no match by now, raise
100
+ raise
101
+ rescue
102
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
103
+ end
104
+ end
105
+ end
106
+
107
+ end
108
+ end
@@ -0,0 +1,108 @@
1
+ # Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2
+
3
+ require "date"
4
+ require "time"
5
+
6
+ module Algolia
7
+ module Search
8
+ module OptionalWords
9
+ class << self
10
+ # List of class defined in oneOf (OpenAPI v3)
11
+ def openapi_one_of
12
+ [
13
+ :"Array<String>",
14
+ :"String"
15
+ ]
16
+ end
17
+
18
+ # Builds the object
19
+ # @param [Mixed] Data to be matched against the list of oneOf items
20
+ # @return [Object] Returns the model or the data itself
21
+ def build(data)
22
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
23
+ # Note:
24
+ # - We do not attempt to check whether exactly one item matches.
25
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
26
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
27
+ # - TODO: scalar values are de facto behaving as if they were nullable.
28
+ # - TODO: logging when debugging is set.
29
+ openapi_one_of.each do |klass|
30
+ begin
31
+ # "nullable: true"
32
+ next if klass == :AnyType
33
+ typed_data = find_and_cast_into_type(klass, data)
34
+ return typed_data if typed_data
35
+ # rescue all errors so we keep iterating even if the current item lookup raises
36
+ rescue
37
+ end
38
+ end
39
+
40
+ openapi_one_of.include?(:AnyType) ? data : nil
41
+ end
42
+
43
+ private
44
+
45
+ SchemaMismatchError = Class.new(StandardError)
46
+
47
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
48
+ def find_and_cast_into_type(klass, data)
49
+ return if data.nil?
50
+
51
+ case klass.to_s
52
+ when "Boolean"
53
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
54
+ when "Float"
55
+ return data if data.instance_of?(Float)
56
+ when "Integer"
57
+ return data if data.instance_of?(Integer)
58
+ when "Time"
59
+ return Time.parse(data)
60
+ when "Date"
61
+ return Date.parse(data)
62
+ when "String"
63
+ return data if data.instance_of?(String)
64
+ # "type: object"
65
+ when "Object"
66
+ return data if data.instance_of?(Hash)
67
+ # "type: array"
68
+ when /\AArray<(?<sub_type>.+)>\z/
69
+ if data.instance_of?(Array)
70
+ sub_type = Regexp.last_match[:sub_type]
71
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
72
+ end
73
+ # "type: object" with "additionalProperties: { ... }"
74
+ when /\AHash<String, (?<sub_type>.+)>\z/
75
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
76
+ sub_type = Regexp.last_match[:sub_type]
77
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
78
+ end
79
+ # model
80
+ else
81
+ const = Algolia::Search.const_get(klass)
82
+ if const
83
+ if const.respond_to?(:openapi_one_of)
84
+ # nested oneOf model
85
+ model = const.build(data)
86
+ elsif const.respond_to?(:acceptable_attributes)
87
+ # raise if data contains keys that are not known to the model
88
+ raise unless (data.keys - const.acceptable_attributes).empty?
89
+ model = const.build_from_hash(data)
90
+ else
91
+ # maybe it's an enum
92
+ model = const.build_from_hash(data)
93
+ end
94
+
95
+ return model if model
96
+ end
97
+ end
98
+
99
+ # if no match by now, raise
100
+ raise
101
+ rescue
102
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
103
+ end
104
+ end
105
+ end
106
+
107
+ end
108
+ end