algolia 3.37.0 → 3.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/algolia/api/monitoring_client.rb +2 -2
  5. data/lib/algolia/models/composition/{external.rb → injected_item_external.rb} +6 -3
  6. data/lib/algolia/models/composition/{external_source.rb → injected_item_external_source.rb} +11 -4
  7. data/lib/algolia/models/composition/injected_item_recommend_source.rb +216 -0
  8. data/lib/algolia/models/composition/{search.rb → injected_item_search.rb} +6 -3
  9. data/lib/algolia/models/composition/{search_source.rb → injected_item_search_source.rb} +11 -4
  10. data/lib/algolia/models/composition/injected_item_source.rb +3 -2
  11. data/lib/algolia/models/composition/injection.rb +2 -2
  12. data/lib/algolia/models/composition/{injected_item.rb → injection_injected_item.rb} +3 -3
  13. data/lib/algolia/models/composition/{main.rb → injection_main.rb} +8 -6
  14. data/lib/algolia/models/composition/injection_main_recommend_source.rb +216 -0
  15. data/lib/algolia/models/composition/{composition_source.rb → injection_main_search_source.rb} +12 -4
  16. data/lib/algolia/models/composition/injection_main_source.rb +109 -0
  17. data/lib/algolia/models/composition/main_recommend.rb +250 -0
  18. data/lib/algolia/models/composition/{composition_source_search.rb → main_search.rb} +4 -4
  19. data/lib/algolia/models/composition/model.rb +33 -0
  20. data/lib/algolia/models/composition/recommend.rb +250 -0
  21. data/lib/algolia/models/search/auto_filtering_filter_entry.rb +108 -0
  22. data/lib/algolia/models/search/auto_filtering_result.rb +242 -0
  23. data/lib/algolia/models/search/browse_response.rb +10 -0
  24. data/lib/algolia/models/search/category_prediction.rb +218 -0
  25. data/lib/algolia/models/search/category_prediction_bin.rb +37 -0
  26. data/lib/algolia/models/search/hierarchy_path_entry.rb +227 -0
  27. data/lib/algolia/models/search/query_categorization.rb +248 -0
  28. data/lib/algolia/models/search/query_categorization_type.rb +36 -0
  29. data/lib/algolia/models/search/response_extensions.rb +207 -0
  30. data/lib/algolia/models/search/search_extensions.rb +207 -0
  31. data/lib/algolia/models/search/search_extensions_query_categorization.rb +218 -0
  32. data/lib/algolia/models/search/search_for_hits.rb +14 -4
  33. data/lib/algolia/models/search/search_response.rb +14 -4
  34. data/lib/algolia/version.rb +1 -1
  35. metadata +25 -9
@@ -0,0 +1,218 @@
1
+ # frozen_string_literal: true
2
+
3
+ # 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.
4
+
5
+ require "date"
6
+ require "time"
7
+
8
+ module Algolia
9
+ module Search
10
+ # Parameters for the [Query Categorization](https://www.algolia.com/doc/guides/algolia-ai/query-categorization/) AI feature.
11
+ class SearchExtensionsQueryCategorization
12
+ # Whether to retrieve category predictions in the response `extensions.queryCategorization` field.
13
+ attr_accessor :enable_categories_retrieval
14
+
15
+ # Whether to automatically apply category-based filters and boosts to search results.
16
+ attr_accessor :enable_auto_filtering
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :enable_categories_retrieval => :enableCategoriesRetrieval,
22
+ :enable_auto_filtering => :enableAutoFiltering
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.types_mapping
28
+ {
29
+ :enable_categories_retrieval => :"Boolean",
30
+ :enable_auto_filtering => :"Boolean"
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new(
37
+ []
38
+ )
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ raise(
46
+ ArgumentError,
47
+ "The input argument (attributes) must be a hash in `Algolia::SearchExtensionsQueryCategorization` initialize method"
48
+ )
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ raise(
55
+ ArgumentError,
56
+ "`#{k}` is not a valid attribute in `Algolia::SearchExtensionsQueryCategorization`. Please check the name to make sure it's valid. List of attributes: " +
57
+ self.class.attribute_map.keys.inspect
58
+ )
59
+ end
60
+
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:enable_categories_retrieval)
65
+ self.enable_categories_retrieval = attributes[:enable_categories_retrieval]
66
+ end
67
+
68
+ if attributes.key?(:enable_auto_filtering)
69
+ self.enable_auto_filtering = attributes[:enable_auto_filtering]
70
+ end
71
+ end
72
+
73
+ # Checks equality by comparing each attribute.
74
+ # @param [Object] Object to be compared
75
+ def ==(other)
76
+ return true if self.equal?(other)
77
+ self.class == other.class &&
78
+ enable_categories_retrieval == other.enable_categories_retrieval &&
79
+ enable_auto_filtering == other.enable_auto_filtering
80
+ end
81
+
82
+ # @see the `==` method
83
+ # @param [Object] Object to be compared
84
+ def eql?(other)
85
+ self == other
86
+ end
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Integer] Hash code
90
+ def hash
91
+ [enable_categories_retrieval, enable_auto_filtering].hash
92
+ end
93
+
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def self.build_from_hash(attributes)
98
+ return nil unless attributes.is_a?(Hash)
99
+ attributes = attributes.transform_keys(&:to_sym)
100
+ transformed_hash = {}
101
+ types_mapping.each_pair do |key, type|
102
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
103
+ transformed_hash[key.to_sym] = nil
104
+ elsif type =~ /\AArray<(.*)>/i
105
+ # check to ensure the input is an array given that the attribute
106
+ # is documented as an array but the input is not
107
+ if attributes[attribute_map[key]].is_a?(Array)
108
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
109
+ _deserialize(::Regexp.last_match(1), v)
110
+ }
111
+ end
112
+ elsif !attributes[attribute_map[key]].nil?
113
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
114
+ end
115
+ end
116
+
117
+ new(transformed_hash)
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def self._deserialize(type, value)
125
+ case type.to_sym
126
+ when :Time
127
+ Time.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :Boolean
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ # model
158
+ else
159
+ # models (e.g. Pet) or oneOf
160
+ klass = Algolia::Search.const_get(type)
161
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
162
+ .build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ def to_json(*_args)
179
+ to_hash.to_json
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = send(attr)
188
+ if value.nil?
189
+ is_nullable = self.class.openapi_nullable.include?(attr)
190
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
191
+ end
192
+
193
+ hash[param] = _to_hash(value)
194
+ end
195
+
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to?(:to_hash)
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
@@ -216,6 +216,8 @@ module Algolia
216
216
 
217
217
  attr_accessor :type
218
218
 
219
+ attr_accessor :extensions
220
+
219
221
  # Attribute mapping from ruby-style variable name to JSON key.
220
222
  def self.attribute_map
221
223
  {
@@ -294,7 +296,8 @@ module Algolia
294
296
  :enable_re_ranking => :enableReRanking,
295
297
  :re_ranking_apply_filter => :reRankingApplyFilter,
296
298
  :index_name => :indexName,
297
- :type => :type
299
+ :type => :type,
300
+ :extensions => :extensions
298
301
  }
299
302
  end
300
303
 
@@ -376,7 +379,8 @@ module Algolia
376
379
  :enable_re_ranking => :"Boolean",
377
380
  :re_ranking_apply_filter => :"ReRankingApplyFilter",
378
381
  :index_name => :"String",
379
- :type => :"SearchTypeDefault"
382
+ :type => :"SearchTypeDefault",
383
+ :extensions => :"SearchExtensions"
380
384
  }
381
385
  end
382
386
 
@@ -758,6 +762,10 @@ module Algolia
758
762
  if attributes.key?(:type)
759
763
  self.type = attributes[:type]
760
764
  end
765
+
766
+ if attributes.key?(:extensions)
767
+ self.extensions = attributes[:extensions]
768
+ end
761
769
  end
762
770
 
763
771
  # Checks equality by comparing each attribute.
@@ -840,7 +848,8 @@ module Algolia
840
848
  enable_re_ranking == other.enable_re_ranking &&
841
849
  re_ranking_apply_filter == other.re_ranking_apply_filter &&
842
850
  index_name == other.index_name &&
843
- type == other.type
851
+ type == other.type &&
852
+ extensions == other.extensions
844
853
  end
845
854
 
846
855
  # @see the `==` method
@@ -928,7 +937,8 @@ module Algolia
928
937
  enable_re_ranking,
929
938
  re_ranking_apply_filter,
930
939
  index_name,
931
- type
940
+ type,
941
+ extensions
932
942
  ].hash
933
943
  end
934
944
 
@@ -104,6 +104,8 @@ module Algolia
104
104
  # URL-encoded string of all search parameters.
105
105
  attr_accessor :params
106
106
 
107
+ attr_accessor :extensions
108
+
107
109
  attr_accessor :additional_properties
108
110
 
109
111
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -141,7 +143,8 @@ module Algolia
141
143
  :hits_per_page => :hitsPerPage,
142
144
  :hits => :hits,
143
145
  :query => :query,
144
- :params => :params
146
+ :params => :params,
147
+ :extensions => :extensions
145
148
  }
146
149
  end
147
150
 
@@ -180,7 +183,8 @@ module Algolia
180
183
  :hits_per_page => :"Integer",
181
184
  :hits => :"Array<Hit>",
182
185
  :query => :"String",
183
- :params => :"String"
186
+ :params => :"String",
187
+ :extensions => :"ResponseExtensions"
184
188
  }
185
189
  end
186
190
 
@@ -354,6 +358,10 @@ module Algolia
354
358
  self.params = attributes[:params]
355
359
  end
356
360
 
361
+ if attributes.key?(:extensions)
362
+ self.extensions = attributes[:extensions]
363
+ end
364
+
357
365
  # add extra attribute to additional_properties
358
366
  self.additional_properties ||= {}
359
367
  self.additional_properties.merge!(attributes.reject { |k, _| self.class.attribute_map.key?(k.to_sym) })
@@ -396,7 +404,8 @@ module Algolia
396
404
  hits_per_page == other.hits_per_page &&
397
405
  hits == other.hits &&
398
406
  query == other.query &&
399
- params == other.params
407
+ params == other.params &&
408
+ extensions == other.extensions
400
409
  end
401
410
 
402
411
  # @see the `==` method
@@ -441,7 +450,8 @@ module Algolia
441
450
  hits_per_page,
442
451
  hits,
443
452
  query,
444
- params
453
+ params,
454
+ extensions
445
455
  ].hash
446
456
  end
447
457
 
@@ -3,5 +3,5 @@
3
3
  # 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.
4
4
 
5
5
  module Algolia
6
- VERSION = "3.37.0"
6
+ VERSION = "3.38.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algolia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.37.0
4
+ version: 3.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://alg.li/support
@@ -280,8 +280,6 @@ files:
280
280
  - lib/algolia/models/composition/composition_rules_batch_params.rb
281
281
  - lib/algolia/models/composition/composition_run_applied_rules.rb
282
282
  - lib/algolia/models/composition/composition_run_search_response.rb
283
- - lib/algolia/models/composition/composition_source.rb
284
- - lib/algolia/models/composition/composition_source_search.rb
285
283
  - lib/algolia/models/composition/compositions_search_response.rb
286
284
  - lib/algolia/models/composition/condition.rb
287
285
  - lib/algolia/models/composition/dedup_positioning.rb
@@ -292,11 +290,9 @@ files:
292
290
  - lib/algolia/models/composition/error_base.rb
293
291
  - lib/algolia/models/composition/exact_on_single_word_query.rb
294
292
  - lib/algolia/models/composition/exhaustive.rb
295
- - lib/algolia/models/composition/external.rb
296
293
  - lib/algolia/models/composition/external_injected_item.rb
297
294
  - lib/algolia/models/composition/external_injection.rb
298
295
  - lib/algolia/models/composition/external_ordering.rb
299
- - lib/algolia/models/composition/external_source.rb
300
296
  - lib/algolia/models/composition/facet_filters.rb
301
297
  - lib/algolia/models/composition/facet_hits.rb
302
298
  - lib/algolia/models/composition/facet_ordering.rb
@@ -310,17 +306,28 @@ files:
310
306
  - lib/algolia/models/composition/hit_ranking_info.rb
311
307
  - lib/algolia/models/composition/ignore_plurals.rb
312
308
  - lib/algolia/models/composition/index_settings_facets.rb
313
- - lib/algolia/models/composition/injected_item.rb
309
+ - lib/algolia/models/composition/injected_item_external.rb
310
+ - lib/algolia/models/composition/injected_item_external_source.rb
314
311
  - lib/algolia/models/composition/injected_item_hits_metadata.rb
315
312
  - lib/algolia/models/composition/injected_item_metadata.rb
313
+ - lib/algolia/models/composition/injected_item_recommend_source.rb
314
+ - lib/algolia/models/composition/injected_item_search.rb
315
+ - lib/algolia/models/composition/injected_item_search_source.rb
316
316
  - lib/algolia/models/composition/injected_item_source.rb
317
317
  - lib/algolia/models/composition/injection.rb
318
+ - lib/algolia/models/composition/injection_injected_item.rb
319
+ - lib/algolia/models/composition/injection_main.rb
320
+ - lib/algolia/models/composition/injection_main_recommend_source.rb
321
+ - lib/algolia/models/composition/injection_main_search_source.rb
322
+ - lib/algolia/models/composition/injection_main_source.rb
318
323
  - lib/algolia/models/composition/inside_bounding_box.rb
319
324
  - lib/algolia/models/composition/list_compositions_response.rb
320
- - lib/algolia/models/composition/main.rb
321
325
  - lib/algolia/models/composition/main_injection_query_parameters.rb
326
+ - lib/algolia/models/composition/main_recommend.rb
327
+ - lib/algolia/models/composition/main_search.rb
322
328
  - lib/algolia/models/composition/match_level.rb
323
329
  - lib/algolia/models/composition/matched_geo_location.rb
330
+ - lib/algolia/models/composition/model.rb
324
331
  - lib/algolia/models/composition/multifeed.rb
325
332
  - lib/algolia/models/composition/multiple_batch_request.rb
326
333
  - lib/algolia/models/composition/multiple_batch_response.rb
@@ -331,6 +338,7 @@ files:
331
338
  - lib/algolia/models/composition/personalization.rb
332
339
  - lib/algolia/models/composition/query_type.rb
333
340
  - lib/algolia/models/composition/range.rb
341
+ - lib/algolia/models/composition/recommend.rb
334
342
  - lib/algolia/models/composition/redirect.rb
335
343
  - lib/algolia/models/composition/redirect_rule_index_data.rb
336
344
  - lib/algolia/models/composition/redirect_rule_index_metadata.rb
@@ -345,7 +353,6 @@ files:
345
353
  - lib/algolia/models/composition/rules_batch_composition_action.rb
346
354
  - lib/algolia/models/composition/rules_multiple_batch_request.rb
347
355
  - lib/algolia/models/composition/rules_multiple_batch_response.rb
348
- - lib/algolia/models/composition/search.rb
349
356
  - lib/algolia/models/composition/search_composition_rules_params.rb
350
357
  - lib/algolia/models/composition/search_composition_rules_response.rb
351
358
  - lib/algolia/models/composition/search_for_facet_values_params.rb
@@ -354,7 +361,6 @@ files:
354
361
  - lib/algolia/models/composition/search_for_facet_values_results.rb
355
362
  - lib/algolia/models/composition/search_response.rb
356
363
  - lib/algolia/models/composition/search_results_item.rb
357
- - lib/algolia/models/composition/search_source.rb
358
364
  - lib/algolia/models/composition/snippet_result.rb
359
365
  - lib/algolia/models/composition/snippet_result_option.rb
360
366
  - lib/algolia/models/composition/sort_remaining_by.rb
@@ -677,6 +683,8 @@ files:
677
683
  - lib/algolia/models/search/around_radius_all.rb
678
684
  - lib/algolia/models/search/assign_user_id_params.rb
679
685
  - lib/algolia/models/search/attribute_to_update.rb
686
+ - lib/algolia/models/search/auto_filtering_filter_entry.rb
687
+ - lib/algolia/models/search/auto_filtering_result.rb
680
688
  - lib/algolia/models/search/automatic_facet_filter.rb
681
689
  - lib/algolia/models/search/automatic_facet_filters.rb
682
690
  - lib/algolia/models/search/banner.rb
@@ -697,6 +705,8 @@ files:
697
705
  - lib/algolia/models/search/built_in_operation.rb
698
706
  - lib/algolia/models/search/built_in_operation_type.rb
699
707
  - lib/algolia/models/search/built_in_operation_value.rb
708
+ - lib/algolia/models/search/category_prediction.rb
709
+ - lib/algolia/models/search/category_prediction_bin.rb
700
710
  - lib/algolia/models/search/condition.rb
701
711
  - lib/algolia/models/search/consequence.rb
702
712
  - lib/algolia/models/search/consequence_hide.rb
@@ -740,6 +750,7 @@ files:
740
750
  - lib/algolia/models/search/get_task_response.rb
741
751
  - lib/algolia/models/search/get_top_user_ids_response.rb
742
752
  - lib/algolia/models/search/has_pending_mappings_response.rb
753
+ - lib/algolia/models/search/hierarchy_path_entry.rb
743
754
  - lib/algolia/models/search/highlight_result.rb
744
755
  - lib/algolia/models/search/highlight_result_option.rb
745
756
  - lib/algolia/models/search/hit.rb
@@ -768,6 +779,8 @@ files:
768
779
  - lib/algolia/models/search/promote.rb
769
780
  - lib/algolia/models/search/promote_object_id.rb
770
781
  - lib/algolia/models/search/promote_object_ids.rb
782
+ - lib/algolia/models/search/query_categorization.rb
783
+ - lib/algolia/models/search/query_categorization_type.rb
771
784
  - lib/algolia/models/search/query_type.rb
772
785
  - lib/algolia/models/search/range.rb
773
786
  - lib/algolia/models/search/ranking_info.rb
@@ -783,12 +796,15 @@ files:
783
796
  - lib/algolia/models/search/replace_all_objects_response.rb
784
797
  - lib/algolia/models/search/replace_all_objects_with_transformation_response.rb
785
798
  - lib/algolia/models/search/replace_source_response.rb
799
+ - lib/algolia/models/search/response_extensions.rb
786
800
  - lib/algolia/models/search/rule.rb
787
801
  - lib/algolia/models/search/save_object_response.rb
788
802
  - lib/algolia/models/search/save_synonym_response.rb
789
803
  - lib/algolia/models/search/scope_type.rb
790
804
  - lib/algolia/models/search/search_dictionary_entries_params.rb
791
805
  - lib/algolia/models/search/search_dictionary_entries_response.rb
806
+ - lib/algolia/models/search/search_extensions.rb
807
+ - lib/algolia/models/search/search_extensions_query_categorization.rb
792
808
  - lib/algolia/models/search/search_for_facet_values_request.rb
793
809
  - lib/algolia/models/search/search_for_facet_values_response.rb
794
810
  - lib/algolia/models/search/search_for_facets.rb