algolia 3.25.0 → 3.26.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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/issue.yml +1 -1
  3. data/.github/workflows/release.yml +1 -1
  4. data/CHANGELOG.md +10 -0
  5. data/Gemfile.lock +1 -1
  6. data/lib/algolia/api/composition_client.rb +765 -0
  7. data/lib/algolia/api/ingestion_client.rb +15 -4
  8. data/lib/algolia/api/search_client.rb +4 -2
  9. data/lib/algolia/models/composition/action.rb +34 -0
  10. data/lib/algolia/models/composition/advanced_syntax_features.rb +34 -0
  11. data/lib/algolia/models/composition/alternatives_as_exact.rb +36 -0
  12. data/lib/algolia/models/composition/anchoring.rb +36 -0
  13. data/lib/algolia/models/composition/base_injection_query_parameters.rb +732 -0
  14. data/lib/algolia/models/composition/batch_composition_action.rb +109 -0
  15. data/lib/algolia/models/composition/batch_params.rb +213 -0
  16. data/lib/algolia/models/composition/boolean_string.rb +34 -0
  17. data/lib/algolia/models/composition/composition.rb +244 -0
  18. data/lib/algolia/models/composition/composition_behavior.rb +210 -0
  19. data/lib/algolia/models/composition/composition_rule.rb +280 -0
  20. data/lib/algolia/models/composition/composition_rule_consequence.rb +211 -0
  21. data/lib/algolia/models/composition/composition_rules_batch_params.rb +211 -0
  22. data/lib/algolia/models/composition/composition_source.rb +210 -0
  23. data/lib/algolia/models/composition/composition_source_search.rb +220 -0
  24. data/lib/algolia/models/composition/condition.rb +238 -0
  25. data/lib/algolia/models/composition/delete_composition_action.rb +212 -0
  26. data/lib/algolia/models/composition/delete_composition_rule_action.rb +212 -0
  27. data/lib/algolia/models/composition/distinct.rb +110 -0
  28. data/lib/algolia/models/composition/exact_on_single_word_query.rb +35 -0
  29. data/lib/algolia/models/composition/external.rb +226 -0
  30. data/lib/algolia/models/composition/external_ordering.rb +34 -0
  31. data/lib/algolia/models/composition/external_source.rb +211 -0
  32. data/lib/algolia/models/composition/get_task_response.rb +210 -0
  33. data/lib/algolia/models/composition/ignore_plurals.rb +111 -0
  34. data/lib/algolia/models/composition/injected_item.rb +253 -0
  35. data/lib/algolia/models/composition/injected_item_hits_metadata.rb +222 -0
  36. data/lib/algolia/models/composition/injected_item_metadata.rb +209 -0
  37. data/lib/algolia/models/composition/injected_item_source.rb +109 -0
  38. data/lib/algolia/models/composition/injection.rb +222 -0
  39. data/lib/algolia/models/composition/list_compositions_response.rb +261 -0
  40. data/lib/algolia/models/composition/main.rb +207 -0
  41. data/lib/algolia/models/composition/main_injection_query_parameters.rb +807 -0
  42. data/lib/algolia/models/composition/multiple_batch_request.rb +221 -0
  43. data/lib/algolia/models/composition/multiple_batch_response.rb +213 -0
  44. data/lib/algolia/models/composition/optional_words.rb +110 -0
  45. data/lib/algolia/models/composition/query_type.rb +35 -0
  46. data/lib/algolia/models/composition/remove_stop_words.rb +110 -0
  47. data/lib/algolia/models/composition/remove_words_if_no_results.rb +36 -0
  48. data/lib/algolia/models/composition/rules_batch_composition_action.rb +109 -0
  49. data/lib/algolia/models/composition/rules_multiple_batch_request.rb +221 -0
  50. data/lib/algolia/models/composition/rules_multiple_batch_response.rb +211 -0
  51. data/lib/algolia/models/composition/search.rb +217 -0
  52. data/lib/algolia/models/composition/search_composition_rules_params.rb +261 -0
  53. data/lib/algolia/models/composition/search_composition_rules_response.rb +249 -0
  54. data/lib/algolia/models/composition/search_source.rb +211 -0
  55. data/lib/algolia/models/composition/task_id_response.rb +211 -0
  56. data/lib/algolia/models/composition/task_status.rb +34 -0
  57. data/lib/algolia/models/composition/time_range.rb +219 -0
  58. data/lib/algolia/models/composition/typo_tolerance.rb +110 -0
  59. data/lib/algolia/models/composition/typo_tolerance_enum.rb +36 -0
  60. data/lib/algolia/version.rb +1 -1
  61. metadata +52 -1
@@ -0,0 +1,807 @@
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 Composition
10
+ class MainInjectionQueryParameters
11
+ # Whether to support phrase matching and excluding words from search queries Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
12
+ attr_accessor :advanced_syntax
13
+
14
+ # Advanced search syntax features you want to support - `exactPhrase`. Phrases in quotes must match exactly. For example, `sparkly blue \"iPhone case\"` only returns records with the exact string \"iPhone case\" - `excludeWords`. Query words prefixed with a `-` must not occur in a record. For example, `search -engine` matches records that contain \"search\" but not \"engine\" This setting only has an effect if `advancedSyntax` is true.
15
+ attr_accessor :advanced_syntax_features
16
+
17
+ # Whether to allow typos on numbers in the search query Turn off this setting to reduce the number of irrelevant matches when searching in large sets of similar numbers.
18
+ attr_accessor :allow_typos_on_numeric_tokens
19
+
20
+ # Determine which plurals and synonyms should be considered an exact matches By default, Algolia treats singular and plural forms of a word, and single-word synonyms, as [exact](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#exact) matches when searching. For example - \"swimsuit\" and \"swimsuits\" are treated the same - \"swimsuit\" and \"swimwear\" are treated the same (if they are [synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#regular-synonyms)) - `ignorePlurals`. Plurals and similar declensions added by the `ignorePlurals` setting are considered exact matches - `singleWordSynonym`. Single-word synonyms, such as \"NY\" = \"NYC\", are considered exact matches - `multiWordsSynonym`. Multi-word synonyms, such as \"NY\" = \"New York\", are considered exact matches.
21
+ attr_accessor :alternatives_as_exact
22
+
23
+ # Whether this search will be included in Analytics.
24
+ attr_accessor :analytics
25
+
26
+ # Whether the best matching attribute should be determined by minimum proximity This setting only affects ranking if the Attribute ranking criterion comes before Proximity in the `ranking` setting. If true, the best matching attribute is selected based on the minimum proximity of multiple matches. Otherwise, the best matching attribute is determined by the order in the `searchableAttributes` setting.
27
+ attr_accessor :attribute_criteria_computed_by_min_proximity
28
+
29
+ # Attributes to highlight By default, all searchable attributes are highlighted. Use `*` to highlight all attributes or use an empty array `[]` to turn off highlighting. Attribute names are case-sensitive With highlighting, strings that match the search query are surrounded by HTML tags defined by `highlightPreTag` and `highlightPostTag`. You can use this to visually highlight matching parts of a search query in your UI For more information, see [Highlighting and snippeting](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/highlighting-snippeting/js/).
30
+ attr_accessor :attributes_to_highlight
31
+
32
+ # 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.
33
+ attr_accessor :attributes_to_retrieve
34
+
35
+ # Attributes for which to enable snippets. Attribute names are case-sensitive Snippets provide additional context to matched words. If you enable snippets, they include 10 words, including the matched word. The matched word will also be wrapped by HTML tags for highlighting. You can adjust the number of words with the following notation: `ATTRIBUTE:NUMBER`, where `NUMBER` is the number of words to be extracted.
36
+ attr_accessor :attributes_to_snippet
37
+
38
+ # 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](https://www.algolia.com/guides/sending-events/getting-started/).
39
+ attr_accessor :click_analytics
40
+
41
+ # Whether to split compound words in the query into their building blocks For more information, see [Word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words). Word segmentation is supported for these languages: German, Dutch, Finnish, Swedish, and Norwegian. Decompounding doesn't work for words with [non-spacing mark Unicode characters](https://www.charactercodes.net/category/non-spacing_mark). For example, `Gartenstühle` won't be decompounded if the `ü` consists of `u` (U+0075) and `◌̈` (U+0308).
42
+ attr_accessor :decompound_query
43
+
44
+ # 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.
45
+ attr_accessor :disable_exact_on_attributes
46
+
47
+ # Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). Attribute names are case-sensitive Returning only exact matches can help when - [Searching in hyphenated attributes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/how-to/how-to-search-in-hyphenated-attributes/). - Reducing the number of matches when you have too many. This can happen with attributes that are long blocks of text, such as product descriptions Consider alternatives such as `disableTypoToleranceOnWords` or adding synonyms if your attributes have intentional unusual spellings that might look like typos.
48
+ attr_accessor :disable_typo_tolerance_on_attributes
49
+
50
+ attr_accessor :distinct
51
+
52
+ # Whether to enable A/B testing for this search.
53
+ attr_accessor :enable_ab_test
54
+
55
+ # Whether to enable Personalization.
56
+ attr_accessor :enable_personalization
57
+
58
+ # Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/) This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard.
59
+ attr_accessor :enable_re_ranking
60
+
61
+ # Whether to enable rules.
62
+ attr_accessor :enable_rules
63
+
64
+ attr_accessor :exact_on_single_word_query
65
+
66
+ attr_accessor :facet_filters
67
+
68
+ # Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **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](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/).
69
+ attr_accessor :filters
70
+
71
+ # Whether the search response should include detailed ranking information.
72
+ attr_accessor :get_ranking_info
73
+
74
+ # HTML tag to insert after the highlighted parts in all highlighted results and snippets.
75
+ attr_accessor :highlight_post_tag
76
+
77
+ # HTML tag to insert before the highlighted parts in all highlighted results and snippets.
78
+ attr_accessor :highlight_pre_tag
79
+
80
+ attr_accessor :ignore_plurals
81
+
82
+ # 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).
83
+ attr_accessor :max_facet_hits
84
+
85
+ # Minimum proximity score for two matching words This adjusts the [Proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity) by equally scoring matches that are farther apart For example, if `minProximity` is 2, neighboring matches and matches with one word between them would have the same score.
86
+ attr_accessor :min_proximity
87
+
88
+ # Minimum number of characters a word in the search query must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos).
89
+ attr_accessor :min_word_sizefor1_typo
90
+
91
+ # Minimum number of characters a word in the search query must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos).
92
+ attr_accessor :min_word_sizefor2_typos
93
+
94
+ # 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`.
95
+ attr_accessor :natural_languages
96
+
97
+ attr_accessor :numeric_filters
98
+
99
+ attr_accessor :optional_filters
100
+
101
+ attr_accessor :optional_words
102
+
103
+ # Whether to include this search when calculating processing-time percentiles.
104
+ attr_accessor :percentile_computation
105
+
106
+ # 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](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact).
107
+ attr_accessor :personalization_impact
108
+
109
+ # Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first** **You should always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/).
110
+ attr_accessor :query_languages
111
+
112
+ attr_accessor :query_type
113
+
114
+ attr_accessor :remove_stop_words
115
+
116
+ attr_accessor :remove_words_if_no_results
117
+
118
+ # Whether to replace a highlighted word with the matched synonym By default, the original words are highlighted even if a synonym matches. For example, with `home` as a synonym for `house` and a search for `home`, records matching either \"home\" or \"house\" are included in the search results, and either \"home\" or \"house\" are highlighted With `replaceSynonymsInHighlight` set to `true`, a search for `home` still matches the same records, but all occurrences of \"house\" are replaced by \"home\" in the highlighted response.
119
+ attr_accessor :replace_synonyms_in_highlight
120
+
121
+ # 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 properties should be included An empty list may lead to an empty API response (except properties you can't exclude) You can't exclude these properties: `message`, `warning`, `cursor`, `abTestVariantID`, or any property added by setting `getRankingInfo` to true Your search depends on the `hits` field. If you omit this field, searches won't return any results. Your UI might also depend on other properties, for example, for pagination. Before restricting the response size, check the impact on your search experience.
122
+ attr_accessor :response_fields
123
+
124
+ # Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted.
125
+ attr_accessor :restrict_highlight_and_snippet_arrays
126
+
127
+ # Restricts a search to a subset of your searchable attributes. Attribute names are case-sensitive.
128
+ attr_accessor :restrict_searchable_attributes
129
+
130
+ # Assigns a rule context to the search query [Rule contexts](https://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.
131
+ attr_accessor :rule_contexts
132
+
133
+ # String used as an ellipsis indicator when a snippet is truncated.
134
+ attr_accessor :snippet_ellipsis_text
135
+
136
+ # Whether to take into account an index's synonyms for this search.
137
+ attr_accessor :synonyms
138
+
139
+ attr_accessor :typo_tolerance
140
+
141
+ # 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`.
142
+ attr_accessor :faceting_after_distinct
143
+
144
+ # 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](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts).
145
+ attr_accessor :facets
146
+
147
+ # Number of hits per page.
148
+ attr_accessor :hits_per_page
149
+
150
+ # Maximum number of facet values to return for each facet.
151
+ attr_accessor :max_values_per_facet
152
+
153
+ # Order in which to retrieve facet values - `count`. Facet values are retrieved by decreasing count. The count is the number of matching records containing this facet value - `alpha`. Retrieve facet values alphabetically This setting doesn't influence how facet values are displayed in your UI (see `renderingContent`). For more information, see [facet value display](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/facet-display/js/).
154
+ attr_accessor :sort_facet_values_by
155
+
156
+ # 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](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores).
157
+ attr_accessor :sum_or_filters_scores
158
+
159
+ # Attribute mapping from ruby-style variable name to JSON key.
160
+ def self.attribute_map
161
+ {
162
+ :advanced_syntax => :advancedSyntax,
163
+ :advanced_syntax_features => :advancedSyntaxFeatures,
164
+ :allow_typos_on_numeric_tokens => :allowTyposOnNumericTokens,
165
+ :alternatives_as_exact => :alternativesAsExact,
166
+ :analytics => :analytics,
167
+ :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity,
168
+ :attributes_to_highlight => :attributesToHighlight,
169
+ :attributes_to_retrieve => :attributesToRetrieve,
170
+ :attributes_to_snippet => :attributesToSnippet,
171
+ :click_analytics => :clickAnalytics,
172
+ :decompound_query => :decompoundQuery,
173
+ :disable_exact_on_attributes => :disableExactOnAttributes,
174
+ :disable_typo_tolerance_on_attributes => :disableTypoToleranceOnAttributes,
175
+ :distinct => :distinct,
176
+ :enable_ab_test => :enableABTest,
177
+ :enable_personalization => :enablePersonalization,
178
+ :enable_re_ranking => :enableReRanking,
179
+ :enable_rules => :enableRules,
180
+ :exact_on_single_word_query => :exactOnSingleWordQuery,
181
+ :facet_filters => :facetFilters,
182
+ :filters => :filters,
183
+ :get_ranking_info => :getRankingInfo,
184
+ :highlight_post_tag => :highlightPostTag,
185
+ :highlight_pre_tag => :highlightPreTag,
186
+ :ignore_plurals => :ignorePlurals,
187
+ :max_facet_hits => :maxFacetHits,
188
+ :min_proximity => :minProximity,
189
+ :min_word_sizefor1_typo => :minWordSizefor1Typo,
190
+ :min_word_sizefor2_typos => :minWordSizefor2Typos,
191
+ :natural_languages => :naturalLanguages,
192
+ :numeric_filters => :numericFilters,
193
+ :optional_filters => :optionalFilters,
194
+ :optional_words => :optionalWords,
195
+ :percentile_computation => :percentileComputation,
196
+ :personalization_impact => :personalizationImpact,
197
+ :query_languages => :queryLanguages,
198
+ :query_type => :queryType,
199
+ :remove_stop_words => :removeStopWords,
200
+ :remove_words_if_no_results => :removeWordsIfNoResults,
201
+ :replace_synonyms_in_highlight => :replaceSynonymsInHighlight,
202
+ :response_fields => :responseFields,
203
+ :restrict_highlight_and_snippet_arrays => :restrictHighlightAndSnippetArrays,
204
+ :restrict_searchable_attributes => :restrictSearchableAttributes,
205
+ :rule_contexts => :ruleContexts,
206
+ :snippet_ellipsis_text => :snippetEllipsisText,
207
+ :synonyms => :synonyms,
208
+ :typo_tolerance => :typoTolerance,
209
+ :faceting_after_distinct => :facetingAfterDistinct,
210
+ :facets => :facets,
211
+ :hits_per_page => :hitsPerPage,
212
+ :max_values_per_facet => :maxValuesPerFacet,
213
+ :sort_facet_values_by => :sortFacetValuesBy,
214
+ :sum_or_filters_scores => :sumOrFiltersScores
215
+ }
216
+ end
217
+
218
+ # Attribute type mapping.
219
+ def self.types_mapping
220
+ {
221
+ :advanced_syntax => :"Boolean",
222
+ :advanced_syntax_features => :"Array<AdvancedSyntaxFeatures>",
223
+ :allow_typos_on_numeric_tokens => :"Boolean",
224
+ :alternatives_as_exact => :"Array<AlternativesAsExact>",
225
+ :analytics => :"Boolean",
226
+ :attribute_criteria_computed_by_min_proximity => :"Boolean",
227
+ :attributes_to_highlight => :"Array<String>",
228
+ :attributes_to_retrieve => :"Array<String>",
229
+ :attributes_to_snippet => :"Array<String>",
230
+ :click_analytics => :"Boolean",
231
+ :decompound_query => :"Boolean",
232
+ :disable_exact_on_attributes => :"Array<String>",
233
+ :disable_typo_tolerance_on_attributes => :"Array<String>",
234
+ :distinct => :"Distinct",
235
+ :enable_ab_test => :"Boolean",
236
+ :enable_personalization => :"Boolean",
237
+ :enable_re_ranking => :"Boolean",
238
+ :enable_rules => :"Boolean",
239
+ :exact_on_single_word_query => :"ExactOnSingleWordQuery",
240
+ :facet_filters => :"FacetFilters",
241
+ :filters => :"String",
242
+ :get_ranking_info => :"Boolean",
243
+ :highlight_post_tag => :"String",
244
+ :highlight_pre_tag => :"String",
245
+ :ignore_plurals => :"IgnorePlurals",
246
+ :max_facet_hits => :"Integer",
247
+ :min_proximity => :"Integer",
248
+ :min_word_sizefor1_typo => :"Integer",
249
+ :min_word_sizefor2_typos => :"Integer",
250
+ :natural_languages => :"Array<SupportedLanguage>",
251
+ :numeric_filters => :"NumericFilters",
252
+ :optional_filters => :"OptionalFilters",
253
+ :optional_words => :"OptionalWords",
254
+ :percentile_computation => :"Boolean",
255
+ :personalization_impact => :"Integer",
256
+ :query_languages => :"Array<SupportedLanguage>",
257
+ :query_type => :"QueryType",
258
+ :remove_stop_words => :"RemoveStopWords",
259
+ :remove_words_if_no_results => :"RemoveWordsIfNoResults",
260
+ :replace_synonyms_in_highlight => :"Boolean",
261
+ :response_fields => :"Array<String>",
262
+ :restrict_highlight_and_snippet_arrays => :"Boolean",
263
+ :restrict_searchable_attributes => :"Array<String>",
264
+ :rule_contexts => :"Array<String>",
265
+ :snippet_ellipsis_text => :"String",
266
+ :synonyms => :"Boolean",
267
+ :typo_tolerance => :"TypoTolerance",
268
+ :faceting_after_distinct => :"Boolean",
269
+ :facets => :"Array<String>",
270
+ :hits_per_page => :"Integer",
271
+ :max_values_per_facet => :"Integer",
272
+ :sort_facet_values_by => :"String",
273
+ :sum_or_filters_scores => :"Boolean"
274
+ }
275
+ end
276
+
277
+ # List of attributes with nullable: true
278
+ def self.openapi_nullable
279
+ Set.new(
280
+ [
281
+ :optional_words
282
+ ]
283
+ )
284
+ end
285
+
286
+ # List of class defined in allOf (OpenAPI v3)
287
+ def self.openapi_all_of
288
+ [
289
+ :"BaseInjectionQueryParameters"
290
+ ]
291
+ end
292
+
293
+ # Initializes the object
294
+ # @param [Hash] attributes Model attributes in the form of hash
295
+ def initialize(attributes = {})
296
+ if (!attributes.is_a?(Hash))
297
+ raise(
298
+ ArgumentError,
299
+ "The input argument (attributes) must be a hash in `Algolia::MainInjectionQueryParameters` initialize method"
300
+ )
301
+ end
302
+
303
+ # check to see if the attribute exists and convert string to symbol for hash key
304
+ attributes = attributes.each_with_object({}) { |(k, v), h|
305
+ if (!self.class.attribute_map.key?(k.to_sym))
306
+ raise(
307
+ ArgumentError,
308
+ "`#{k}` is not a valid attribute in `Algolia::MainInjectionQueryParameters`. Please check the name to make sure it's valid. List of attributes: " +
309
+ self.class.attribute_map.keys.inspect
310
+ )
311
+ end
312
+
313
+ h[k.to_sym] = v
314
+ }
315
+
316
+ if attributes.key?(:advanced_syntax)
317
+ self.advanced_syntax = attributes[:advanced_syntax]
318
+ end
319
+
320
+ if attributes.key?(:advanced_syntax_features)
321
+ if (value = attributes[:advanced_syntax_features]).is_a?(Array)
322
+ self.advanced_syntax_features = value
323
+ end
324
+ end
325
+
326
+ if attributes.key?(:allow_typos_on_numeric_tokens)
327
+ self.allow_typos_on_numeric_tokens = attributes[:allow_typos_on_numeric_tokens]
328
+ end
329
+
330
+ if attributes.key?(:alternatives_as_exact)
331
+ if (value = attributes[:alternatives_as_exact]).is_a?(Array)
332
+ self.alternatives_as_exact = value
333
+ end
334
+ end
335
+
336
+ if attributes.key?(:analytics)
337
+ self.analytics = attributes[:analytics]
338
+ end
339
+
340
+ if attributes.key?(:attribute_criteria_computed_by_min_proximity)
341
+ self.attribute_criteria_computed_by_min_proximity = attributes[:attribute_criteria_computed_by_min_proximity]
342
+ end
343
+
344
+ if attributes.key?(:attributes_to_highlight)
345
+ if (value = attributes[:attributes_to_highlight]).is_a?(Array)
346
+ self.attributes_to_highlight = value
347
+ end
348
+ end
349
+
350
+ if attributes.key?(:attributes_to_retrieve)
351
+ if (value = attributes[:attributes_to_retrieve]).is_a?(Array)
352
+ self.attributes_to_retrieve = value
353
+ end
354
+ end
355
+
356
+ if attributes.key?(:attributes_to_snippet)
357
+ if (value = attributes[:attributes_to_snippet]).is_a?(Array)
358
+ self.attributes_to_snippet = value
359
+ end
360
+ end
361
+
362
+ if attributes.key?(:click_analytics)
363
+ self.click_analytics = attributes[:click_analytics]
364
+ end
365
+
366
+ if attributes.key?(:decompound_query)
367
+ self.decompound_query = attributes[:decompound_query]
368
+ end
369
+
370
+ if attributes.key?(:disable_exact_on_attributes)
371
+ if (value = attributes[:disable_exact_on_attributes]).is_a?(Array)
372
+ self.disable_exact_on_attributes = value
373
+ end
374
+ end
375
+
376
+ if attributes.key?(:disable_typo_tolerance_on_attributes)
377
+ if (value = attributes[:disable_typo_tolerance_on_attributes]).is_a?(Array)
378
+ self.disable_typo_tolerance_on_attributes = value
379
+ end
380
+ end
381
+
382
+ if attributes.key?(:distinct)
383
+ self.distinct = attributes[:distinct]
384
+ end
385
+
386
+ if attributes.key?(:enable_ab_test)
387
+ self.enable_ab_test = attributes[:enable_ab_test]
388
+ end
389
+
390
+ if attributes.key?(:enable_personalization)
391
+ self.enable_personalization = attributes[:enable_personalization]
392
+ end
393
+
394
+ if attributes.key?(:enable_re_ranking)
395
+ self.enable_re_ranking = attributes[:enable_re_ranking]
396
+ end
397
+
398
+ if attributes.key?(:enable_rules)
399
+ self.enable_rules = attributes[:enable_rules]
400
+ end
401
+
402
+ if attributes.key?(:exact_on_single_word_query)
403
+ self.exact_on_single_word_query = attributes[:exact_on_single_word_query]
404
+ end
405
+
406
+ if attributes.key?(:facet_filters)
407
+ self.facet_filters = attributes[:facet_filters]
408
+ end
409
+
410
+ if attributes.key?(:filters)
411
+ self.filters = attributes[:filters]
412
+ end
413
+
414
+ if attributes.key?(:get_ranking_info)
415
+ self.get_ranking_info = attributes[:get_ranking_info]
416
+ end
417
+
418
+ if attributes.key?(:highlight_post_tag)
419
+ self.highlight_post_tag = attributes[:highlight_post_tag]
420
+ end
421
+
422
+ if attributes.key?(:highlight_pre_tag)
423
+ self.highlight_pre_tag = attributes[:highlight_pre_tag]
424
+ end
425
+
426
+ if attributes.key?(:ignore_plurals)
427
+ self.ignore_plurals = attributes[:ignore_plurals]
428
+ end
429
+
430
+ if attributes.key?(:max_facet_hits)
431
+ self.max_facet_hits = attributes[:max_facet_hits]
432
+ end
433
+
434
+ if attributes.key?(:min_proximity)
435
+ self.min_proximity = attributes[:min_proximity]
436
+ end
437
+
438
+ if attributes.key?(:min_word_sizefor1_typo)
439
+ self.min_word_sizefor1_typo = attributes[:min_word_sizefor1_typo]
440
+ end
441
+
442
+ if attributes.key?(:min_word_sizefor2_typos)
443
+ self.min_word_sizefor2_typos = attributes[:min_word_sizefor2_typos]
444
+ end
445
+
446
+ if attributes.key?(:natural_languages)
447
+ if (value = attributes[:natural_languages]).is_a?(Array)
448
+ self.natural_languages = value
449
+ end
450
+ end
451
+
452
+ if attributes.key?(:numeric_filters)
453
+ self.numeric_filters = attributes[:numeric_filters]
454
+ end
455
+
456
+ if attributes.key?(:optional_filters)
457
+ self.optional_filters = attributes[:optional_filters]
458
+ end
459
+
460
+ if attributes.key?(:optional_words)
461
+ self.optional_words = attributes[:optional_words]
462
+ end
463
+
464
+ if attributes.key?(:percentile_computation)
465
+ self.percentile_computation = attributes[:percentile_computation]
466
+ end
467
+
468
+ if attributes.key?(:personalization_impact)
469
+ self.personalization_impact = attributes[:personalization_impact]
470
+ end
471
+
472
+ if attributes.key?(:query_languages)
473
+ if (value = attributes[:query_languages]).is_a?(Array)
474
+ self.query_languages = value
475
+ end
476
+ end
477
+
478
+ if attributes.key?(:query_type)
479
+ self.query_type = attributes[:query_type]
480
+ end
481
+
482
+ if attributes.key?(:remove_stop_words)
483
+ self.remove_stop_words = attributes[:remove_stop_words]
484
+ end
485
+
486
+ if attributes.key?(:remove_words_if_no_results)
487
+ self.remove_words_if_no_results = attributes[:remove_words_if_no_results]
488
+ end
489
+
490
+ if attributes.key?(:replace_synonyms_in_highlight)
491
+ self.replace_synonyms_in_highlight = attributes[:replace_synonyms_in_highlight]
492
+ end
493
+
494
+ if attributes.key?(:response_fields)
495
+ if (value = attributes[:response_fields]).is_a?(Array)
496
+ self.response_fields = value
497
+ end
498
+ end
499
+
500
+ if attributes.key?(:restrict_highlight_and_snippet_arrays)
501
+ self.restrict_highlight_and_snippet_arrays = attributes[:restrict_highlight_and_snippet_arrays]
502
+ end
503
+
504
+ if attributes.key?(:restrict_searchable_attributes)
505
+ if (value = attributes[:restrict_searchable_attributes]).is_a?(Array)
506
+ self.restrict_searchable_attributes = value
507
+ end
508
+ end
509
+
510
+ if attributes.key?(:rule_contexts)
511
+ if (value = attributes[:rule_contexts]).is_a?(Array)
512
+ self.rule_contexts = value
513
+ end
514
+ end
515
+
516
+ if attributes.key?(:snippet_ellipsis_text)
517
+ self.snippet_ellipsis_text = attributes[:snippet_ellipsis_text]
518
+ end
519
+
520
+ if attributes.key?(:synonyms)
521
+ self.synonyms = attributes[:synonyms]
522
+ end
523
+
524
+ if attributes.key?(:typo_tolerance)
525
+ self.typo_tolerance = attributes[:typo_tolerance]
526
+ end
527
+
528
+ if attributes.key?(:faceting_after_distinct)
529
+ self.faceting_after_distinct = attributes[:faceting_after_distinct]
530
+ end
531
+
532
+ if attributes.key?(:facets)
533
+ if (value = attributes[:facets]).is_a?(Array)
534
+ self.facets = value
535
+ end
536
+ end
537
+
538
+ if attributes.key?(:hits_per_page)
539
+ self.hits_per_page = attributes[:hits_per_page]
540
+ end
541
+
542
+ if attributes.key?(:max_values_per_facet)
543
+ self.max_values_per_facet = attributes[:max_values_per_facet]
544
+ end
545
+
546
+ if attributes.key?(:sort_facet_values_by)
547
+ self.sort_facet_values_by = attributes[:sort_facet_values_by]
548
+ end
549
+
550
+ if attributes.key?(:sum_or_filters_scores)
551
+ self.sum_or_filters_scores = attributes[:sum_or_filters_scores]
552
+ end
553
+ end
554
+
555
+ # Checks equality by comparing each attribute.
556
+ # @param [Object] Object to be compared
557
+ def ==(other)
558
+ return true if self.equal?(other)
559
+ self.class == other.class &&
560
+ advanced_syntax == other.advanced_syntax &&
561
+ advanced_syntax_features == other.advanced_syntax_features &&
562
+ allow_typos_on_numeric_tokens == other.allow_typos_on_numeric_tokens &&
563
+ alternatives_as_exact == other.alternatives_as_exact &&
564
+ analytics == other.analytics &&
565
+ attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity &&
566
+ attributes_to_highlight == other.attributes_to_highlight &&
567
+ attributes_to_retrieve == other.attributes_to_retrieve &&
568
+ attributes_to_snippet == other.attributes_to_snippet &&
569
+ click_analytics == other.click_analytics &&
570
+ decompound_query == other.decompound_query &&
571
+ disable_exact_on_attributes == other.disable_exact_on_attributes &&
572
+ disable_typo_tolerance_on_attributes == other.disable_typo_tolerance_on_attributes &&
573
+ distinct == other.distinct &&
574
+ enable_ab_test == other.enable_ab_test &&
575
+ enable_personalization == other.enable_personalization &&
576
+ enable_re_ranking == other.enable_re_ranking &&
577
+ enable_rules == other.enable_rules &&
578
+ exact_on_single_word_query == other.exact_on_single_word_query &&
579
+ facet_filters == other.facet_filters &&
580
+ filters == other.filters &&
581
+ get_ranking_info == other.get_ranking_info &&
582
+ highlight_post_tag == other.highlight_post_tag &&
583
+ highlight_pre_tag == other.highlight_pre_tag &&
584
+ ignore_plurals == other.ignore_plurals &&
585
+ max_facet_hits == other.max_facet_hits &&
586
+ min_proximity == other.min_proximity &&
587
+ min_word_sizefor1_typo == other.min_word_sizefor1_typo &&
588
+ min_word_sizefor2_typos == other.min_word_sizefor2_typos &&
589
+ natural_languages == other.natural_languages &&
590
+ numeric_filters == other.numeric_filters &&
591
+ optional_filters == other.optional_filters &&
592
+ optional_words == other.optional_words &&
593
+ percentile_computation == other.percentile_computation &&
594
+ personalization_impact == other.personalization_impact &&
595
+ query_languages == other.query_languages &&
596
+ query_type == other.query_type &&
597
+ remove_stop_words == other.remove_stop_words &&
598
+ remove_words_if_no_results == other.remove_words_if_no_results &&
599
+ replace_synonyms_in_highlight == other.replace_synonyms_in_highlight &&
600
+ response_fields == other.response_fields &&
601
+ restrict_highlight_and_snippet_arrays == other.restrict_highlight_and_snippet_arrays &&
602
+ restrict_searchable_attributes == other.restrict_searchable_attributes &&
603
+ rule_contexts == other.rule_contexts &&
604
+ snippet_ellipsis_text == other.snippet_ellipsis_text &&
605
+ synonyms == other.synonyms &&
606
+ typo_tolerance == other.typo_tolerance &&
607
+ faceting_after_distinct == other.faceting_after_distinct &&
608
+ facets == other.facets &&
609
+ hits_per_page == other.hits_per_page &&
610
+ max_values_per_facet == other.max_values_per_facet &&
611
+ sort_facet_values_by == other.sort_facet_values_by &&
612
+ sum_or_filters_scores == other.sum_or_filters_scores
613
+ end
614
+
615
+ # @see the `==` method
616
+ # @param [Object] Object to be compared
617
+ def eql?(other)
618
+ self == other
619
+ end
620
+
621
+ # Calculates hash code according to all attributes.
622
+ # @return [Integer] Hash code
623
+ def hash
624
+ [
625
+ advanced_syntax,
626
+ advanced_syntax_features,
627
+ allow_typos_on_numeric_tokens,
628
+ alternatives_as_exact,
629
+ analytics,
630
+ attribute_criteria_computed_by_min_proximity,
631
+ attributes_to_highlight,
632
+ attributes_to_retrieve,
633
+ attributes_to_snippet,
634
+ click_analytics,
635
+ decompound_query,
636
+ disable_exact_on_attributes,
637
+ disable_typo_tolerance_on_attributes,
638
+ distinct,
639
+ enable_ab_test,
640
+ enable_personalization,
641
+ enable_re_ranking,
642
+ enable_rules,
643
+ exact_on_single_word_query,
644
+ facet_filters,
645
+ filters,
646
+ get_ranking_info,
647
+ highlight_post_tag,
648
+ highlight_pre_tag,
649
+ ignore_plurals,
650
+ max_facet_hits,
651
+ min_proximity,
652
+ min_word_sizefor1_typo,
653
+ min_word_sizefor2_typos,
654
+ natural_languages,
655
+ numeric_filters,
656
+ optional_filters,
657
+ optional_words,
658
+ percentile_computation,
659
+ personalization_impact,
660
+ query_languages,
661
+ query_type,
662
+ remove_stop_words,
663
+ remove_words_if_no_results,
664
+ replace_synonyms_in_highlight,
665
+ response_fields,
666
+ restrict_highlight_and_snippet_arrays,
667
+ restrict_searchable_attributes,
668
+ rule_contexts,
669
+ snippet_ellipsis_text,
670
+ synonyms,
671
+ typo_tolerance,
672
+ faceting_after_distinct,
673
+ facets,
674
+ hits_per_page,
675
+ max_values_per_facet,
676
+ sort_facet_values_by,
677
+ sum_or_filters_scores
678
+ ].hash
679
+ end
680
+
681
+ # Builds the object from hash
682
+ # @param [Hash] attributes Model attributes in the form of hash
683
+ # @return [Object] Returns the model itself
684
+ def self.build_from_hash(attributes)
685
+ return nil unless attributes.is_a?(Hash)
686
+ attributes = attributes.transform_keys(&:to_sym)
687
+ transformed_hash = {}
688
+ types_mapping.each_pair do |key, type|
689
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
690
+ transformed_hash[key.to_sym] = nil
691
+ elsif type =~ /\AArray<(.*)>/i
692
+ # check to ensure the input is an array given that the attribute
693
+ # is documented as an array but the input is not
694
+ if attributes[attribute_map[key]].is_a?(Array)
695
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
696
+ _deserialize(::Regexp.last_match(1), v)
697
+ }
698
+ end
699
+ elsif !attributes[attribute_map[key]].nil?
700
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
701
+ end
702
+ end
703
+
704
+ new(transformed_hash)
705
+ end
706
+
707
+ # Deserializes the data based on type
708
+ # @param string type Data type
709
+ # @param string value Value to be deserialized
710
+ # @return [Object] Deserialized data
711
+ def self._deserialize(type, value)
712
+ case type.to_sym
713
+ when :Time
714
+ Time.parse(value)
715
+ when :Date
716
+ Date.parse(value)
717
+ when :String
718
+ value.to_s
719
+ when :Integer
720
+ value.to_i
721
+ when :Float
722
+ value.to_f
723
+ when :Boolean
724
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
725
+ true
726
+ else
727
+ false
728
+ end
729
+
730
+ when :Object
731
+ # generic object (usually a Hash), return directly
732
+ value
733
+ when /\AArray<(?<inner_type>.+)>\z/
734
+ inner_type = Regexp.last_match[:inner_type]
735
+ value.map { |v| _deserialize(inner_type, v) }
736
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
737
+ k_type = Regexp.last_match[:k_type]
738
+ v_type = Regexp.last_match[:v_type]
739
+ {}.tap do |hash|
740
+ value.each do |k, v|
741
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
742
+ end
743
+ end
744
+ # model
745
+ else
746
+ # models (e.g. Pet) or oneOf
747
+ klass = Algolia::Composition.const_get(type)
748
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
749
+ .build_from_hash(value)
750
+ end
751
+ end
752
+
753
+ # Returns the string representation of the object
754
+ # @return [String] String presentation of the object
755
+ def to_s
756
+ to_hash.to_s
757
+ end
758
+
759
+ # to_body is an alias to to_hash (backward compatibility)
760
+ # @return [Hash] Returns the object in the form of hash
761
+ def to_body
762
+ to_hash
763
+ end
764
+
765
+ def to_json(*_args)
766
+ to_hash.to_json
767
+ end
768
+
769
+ # Returns the object in the form of hash
770
+ # @return [Hash] Returns the object in the form of hash
771
+ def to_hash
772
+ hash = {}
773
+ self.class.attribute_map.each_pair do |attr, param|
774
+ value = send(attr)
775
+ if value.nil?
776
+ is_nullable = self.class.openapi_nullable.include?(attr)
777
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
778
+ end
779
+
780
+ hash[param] = _to_hash(value)
781
+ end
782
+
783
+ hash
784
+ end
785
+
786
+ # Outputs non-array value in the form of hash
787
+ # For object, use to_hash. Otherwise, just return the value
788
+ # @param [Object] value Any valid value
789
+ # @return [Hash] Returns the value in the form of hash
790
+ def _to_hash(value)
791
+ if value.is_a?(Array)
792
+ value.compact.map { |v| _to_hash(v) }
793
+ elsif value.is_a?(Hash)
794
+ {}.tap do |hash|
795
+ value.each { |k, v| hash[k] = _to_hash(v) }
796
+ end
797
+ elsif value.respond_to?(:to_hash)
798
+ value.to_hash
799
+ else
800
+ value
801
+ end
802
+ end
803
+
804
+ end
805
+
806
+ end
807
+ end