algolia 3.0.0.beta.11 → 3.0.0.beta.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +2 -2
- data/lib/algolia/api/ingestion_client.rb +127 -3
- data/lib/algolia/api/query_suggestions_client.rb +4 -10
- data/lib/algolia/api/search_client.rb +2 -2
- data/lib/algolia/api/usage_client.rb +4 -4
- data/lib/algolia/models/abtesting/{filter_effects_empty_search.rb → empty_search_filter.rb} +3 -3
- data/lib/algolia/models/abtesting/filter_effects.rb +2 -2
- data/lib/algolia/models/abtesting/{filter_effects_outliers.rb → outliers_filter.rb} +3 -3
- data/lib/algolia/models/analytics/{click_positions_inner.rb → click_position.rb} +3 -3
- data/lib/algolia/models/analytics/get_click_positions_response.rb +1 -1
- data/lib/algolia/models/analytics/top_search_with_analytics.rb +1 -1
- data/lib/algolia/models/analytics/top_search_with_revenue_analytics.rb +1 -1
- data/lib/algolia/models/ingestion/destination.rb +15 -4
- data/lib/algolia/models/ingestion/destination_create.rb +15 -4
- data/lib/algolia/models/ingestion/destination_input.rb +1 -2
- data/lib/algolia/models/ingestion/destination_update.rb +15 -4
- data/lib/algolia/models/ingestion/docker_streams_input.rb +1 -0
- data/lib/algolia/models/ingestion/entity_type.rb +32 -0
- data/lib/algolia/models/ingestion/{destination_index_prefix.rb → model.rb} +55 -15
- data/lib/algolia/models/{recommend/trending_items.rb → ingestion/run_source_payload.rb} +39 -34
- data/lib/algolia/models/{search/base_get_api_key_response.rb → ingestion/run_source_response.rb} +19 -15
- data/lib/algolia/models/ingestion/{transformation_try_response_error.rb → transformation_error.rb} +3 -3
- data/lib/algolia/models/ingestion/{source_shopify_base.rb → transformation_models.rb} +14 -12
- data/lib/algolia/models/ingestion/transformation_try_response.rb +1 -1
- data/lib/algolia/models/monitoring/{incidents_inner.rb → incident_entry.rb} +3 -3
- data/lib/algolia/models/monitoring/{indexing_time_response_metrics.rb → indexing_metric.rb} +3 -3
- data/lib/algolia/models/monitoring/indexing_time_response.rb +1 -1
- data/lib/algolia/models/monitoring/infrastructure_response.rb +1 -1
- data/lib/algolia/models/monitoring/{latency_response_metrics.rb → latency_metric.rb} +3 -3
- data/lib/algolia/models/monitoring/latency_response.rb +1 -1
- data/lib/algolia/models/monitoring/{infrastructure_response_metrics.rb → metrics.rb} +3 -6
- data/lib/algolia/models/monitoring/{time_inner.rb → time_entry.rb} +3 -3
- data/lib/algolia/models/{search/search_for_hits_options.rb → query-suggestions/config_status.rb} +43 -36
- data/lib/algolia/models/{recommend/related_products.rb → query-suggestions/log_file.rb} +36 -32
- data/lib/algolia/models/recommend/around_precision.rb +1 -1
- data/lib/algolia/models/recommend/fallback_params.rb +1 -1
- data/lib/algolia/models/recommend/{around_precision_from_value_inner.rb → range.rb} +3 -6
- data/lib/algolia/models/recommend/recommend_rule.rb +1 -1
- data/lib/algolia/models/recommend/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
- data/lib/algolia/models/recommend/redirect_rule_index_metadata.rb +1 -1
- data/lib/algolia/models/recommend/{recommend_rule_metadata.rb → rule_metadata.rb} +3 -3
- data/lib/algolia/models/recommend/search_params.rb +1 -1
- data/lib/algolia/models/recommend/search_params_object.rb +1 -1
- data/lib/algolia/models/search/around_precision.rb +1 -1
- data/lib/algolia/models/search/browse_params_object.rb +1 -1
- data/lib/algolia/models/search/built_in_operation.rb +1 -2
- data/lib/algolia/models/search/built_in_operation_value.rb +105 -0
- data/lib/algolia/models/search/consequence_params.rb +1 -1
- data/lib/algolia/models/search/dictionary_entry.rb +13 -6
- data/lib/algolia/models/search/dictionary_entry_type.rb +32 -0
- data/lib/algolia/models/search/index_settings.rb +2 -2
- data/lib/algolia/models/search/multiple_batch_request.rb +0 -2
- data/lib/algolia/models/search/{around_precision_from_value_inner.rb → range.rb} +3 -6
- data/lib/algolia/models/search/{redirect_rule_index_metadata_data.rb → redirect_rule_index_data.rb} +3 -3
- data/lib/algolia/models/search/redirect_rule_index_metadata.rb +1 -1
- data/lib/algolia/models/search/search_for_facets.rb +1 -1
- data/lib/algolia/models/search/search_for_hits.rb +1 -1
- data/lib/algolia/models/search/search_params_object.rb +1 -1
- data/lib/algolia/models/search/search_params_string.rb +1 -0
- data/lib/algolia/models/search/settings_response.rb +2 -2
- data/lib/algolia/models/usage/{get_usage400_response_error_errors_inner.rb → error_item.rb} +3 -3
- data/lib/algolia/models/usage/{get_usage400_response_error.rb → forbidden_error.rb} +4 -4
- data/lib/algolia/models/usage/{get_usage200_response.rb → index_usage.rb} +4 -4
- data/lib/algolia/models/usage/invalid_request_error.rb +231 -0
- data/lib/algolia/models/usage/{get_usage200_response_statistics_inner.rb → statistic_entry.rb} +3 -3
- data/lib/algolia/version.rb +1 -1
- metadata +30 -65
- data/lib/algolia/models/abtesting/custom_search_params.rb +0 -214
- data/lib/algolia/models/abtesting/error_base.rb +0 -212
- data/lib/algolia/models/analytics/error_base.rb +0 -212
- data/lib/algolia/models/ingestion/error_base.rb +0 -212
- data/lib/algolia/models/insights/error_base.rb +0 -212
- data/lib/algolia/models/monitoring/error_base.rb +0 -212
- data/lib/algolia/models/monitoring/get_servers403_response.rb +0 -211
- data/lib/algolia/models/personalization/error_base.rb +0 -212
- data/lib/algolia/models/query-suggestions/app_id.rb +0 -209
- data/lib/algolia/models/query-suggestions/error_base.rb +0 -212
- data/lib/algolia/models/recommend/base_recommend_request.rb +0 -281
- data/lib/algolia/models/recommend/base_search_params.rb +0 -635
- data/lib/algolia/models/recommend/base_search_params_without_query.rb +0 -616
- data/lib/algolia/models/recommend/base_search_response.rb +0 -499
- data/lib/algolia/models/recommend/error_base.rb +0 -212
- data/lib/algolia/models/recommend/frequently_bought_together.rb +0 -247
- data/lib/algolia/models/recommend/index_settings_as_search_params.rb +0 -788
- data/lib/algolia/models/recommend/looking_similar.rb +0 -256
- data/lib/algolia/models/recommend/recommendations_hits.rb +0 -215
- data/lib/algolia/models/recommend/recommended_for_you.rb +0 -244
- data/lib/algolia/models/recommend/search_pagination.rb +0 -282
- data/lib/algolia/models/recommend/search_params_query.rb +0 -212
- data/lib/algolia/models/recommend/trending_facets.rb +0 -258
- data/lib/algolia/models/search/base_index_settings.rb +0 -426
- data/lib/algolia/models/search/base_search_params.rb +0 -635
- data/lib/algolia/models/search/base_search_params_without_query.rb +0 -616
- data/lib/algolia/models/search/base_search_response.rb +0 -499
- data/lib/algolia/models/search/browse_pagination.rb +0 -274
- data/lib/algolia/models/search/cursor.rb +0 -209
- data/lib/algolia/models/search/error_base.rb +0 -212
- data/lib/algolia/models/search/index_settings_as_search_params.rb +0 -788
- data/lib/algolia/models/search/params.rb +0 -236
- data/lib/algolia/models/search/search_for_facets_options.rb +0 -293
- data/lib/algolia/models/search/search_hits.rb +0 -240
- data/lib/algolia/models/search/search_pagination.rb +0 -282
- data/lib/algolia/models/search/search_params_query.rb +0 -212
- data/lib/algolia/models/search/with_primary.rb +0 -212
- data/lib/algolia/models/usage/error_base.rb +0 -212
- data/lib/algolia/models/usage/get_usage400_response.rb +0 -213
@@ -1,788 +0,0 @@
|
|
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
|
-
class IndexSettingsAsSearchParams
|
9
|
-
# 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.
|
10
|
-
attr_accessor :attributes_to_retrieve
|
11
|
-
|
12
|
-
# Determines the order in which Algolia returns your results. By default, each entry corresponds to a [ranking criteria](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). The tie-breaking algorithm sequentially applies each criterion in the order they're specified. If you configure a replica index for [sorting by an attribute](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-by-attribute/), you put the sorting attribute at the top of the list. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. Before you modify the default setting, you should test your changes in the dashboard, and by [A/B testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/).
|
13
|
-
attr_accessor :ranking
|
14
|
-
|
15
|
-
# Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied.
|
16
|
-
attr_accessor :custom_ranking
|
17
|
-
|
18
|
-
# Relevancy threshold below which less relevant results aren't included in the results. You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
|
19
|
-
attr_accessor :relevancy_strictness
|
20
|
-
|
21
|
-
# 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/).
|
22
|
-
attr_accessor :attributes_to_highlight
|
23
|
-
|
24
|
-
# 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.
|
25
|
-
attr_accessor :attributes_to_snippet
|
26
|
-
|
27
|
-
# HTML tag to insert before the highlighted parts in all highlighted results and snippets.
|
28
|
-
attr_accessor :highlight_pre_tag
|
29
|
-
|
30
|
-
# HTML tag to insert after the highlighted parts in all highlighted results and snippets.
|
31
|
-
attr_accessor :highlight_post_tag
|
32
|
-
|
33
|
-
# String used as an ellipsis indicator when a snippet is truncated.
|
34
|
-
attr_accessor :snippet_ellipsis_text
|
35
|
-
|
36
|
-
# Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted.
|
37
|
-
attr_accessor :restrict_highlight_and_snippet_arrays
|
38
|
-
|
39
|
-
# Number of hits per page.
|
40
|
-
attr_accessor :hits_per_page
|
41
|
-
|
42
|
-
# 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).
|
43
|
-
attr_accessor :min_word_sizefor1_typo
|
44
|
-
|
45
|
-
# 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).
|
46
|
-
attr_accessor :min_word_sizefor2_typos
|
47
|
-
|
48
|
-
attr_accessor :typo_tolerance
|
49
|
-
|
50
|
-
# 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.
|
51
|
-
attr_accessor :allow_typos_on_numeric_tokens
|
52
|
-
|
53
|
-
# 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.
|
54
|
-
attr_accessor :disable_typo_tolerance_on_attributes
|
55
|
-
|
56
|
-
attr_accessor :ignore_plurals
|
57
|
-
|
58
|
-
attr_accessor :remove_stop_words
|
59
|
-
|
60
|
-
# Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics.
|
61
|
-
attr_accessor :keep_diacritics_on_characters
|
62
|
-
|
63
|
-
# 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/).
|
64
|
-
attr_accessor :query_languages
|
65
|
-
|
66
|
-
# Whether to split compound words 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.
|
67
|
-
attr_accessor :decompound_query
|
68
|
-
|
69
|
-
# Whether to enable rules.
|
70
|
-
attr_accessor :enable_rules
|
71
|
-
|
72
|
-
# Whether to enable Personalization.
|
73
|
-
attr_accessor :enable_personalization
|
74
|
-
|
75
|
-
attr_accessor :query_type
|
76
|
-
|
77
|
-
attr_accessor :remove_words_if_no_results
|
78
|
-
|
79
|
-
attr_accessor :mode
|
80
|
-
|
81
|
-
attr_accessor :semantic_search
|
82
|
-
|
83
|
-
# Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
|
84
|
-
attr_accessor :advanced_syntax
|
85
|
-
|
86
|
-
# 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 dividied 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).
|
87
|
-
attr_accessor :optional_words
|
88
|
-
|
89
|
-
# 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 likelyhood 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.
|
90
|
-
attr_accessor :disable_exact_on_attributes
|
91
|
-
|
92
|
-
attr_accessor :exact_on_single_word_query
|
93
|
-
|
94
|
-
# Alternatives of query words that should be considered as exact matches by the Exact ranking criterion. - `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.
|
95
|
-
attr_accessor :alternatives_as_exact
|
96
|
-
|
97
|
-
# 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.
|
98
|
-
attr_accessor :advanced_syntax_features
|
99
|
-
|
100
|
-
attr_accessor :distinct
|
101
|
-
|
102
|
-
# 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 occurences of \"house\" are replaced by \"home\" in the highlighted response.
|
103
|
-
attr_accessor :replace_synonyms_in_highlight
|
104
|
-
|
105
|
-
# 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.
|
106
|
-
attr_accessor :min_proximity
|
107
|
-
|
108
|
-
# 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.
|
109
|
-
attr_accessor :response_fields
|
110
|
-
|
111
|
-
# 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).
|
112
|
-
attr_accessor :max_facet_hits
|
113
|
-
|
114
|
-
# Maximum number of facet values to return for each facet.
|
115
|
-
attr_accessor :max_values_per_facet
|
116
|
-
|
117
|
-
# 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/).
|
118
|
-
attr_accessor :sort_facet_values_by
|
119
|
-
|
120
|
-
# 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.
|
121
|
-
attr_accessor :attribute_criteria_computed_by_min_proximity
|
122
|
-
|
123
|
-
attr_accessor :rendering_content
|
124
|
-
|
125
|
-
# 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.
|
126
|
-
attr_accessor :enable_re_ranking
|
127
|
-
|
128
|
-
attr_accessor :re_ranking_apply_filter
|
129
|
-
|
130
|
-
class EnumAttributeValidator
|
131
|
-
attr_reader :datatype
|
132
|
-
attr_reader :allowable_values
|
133
|
-
|
134
|
-
def initialize(datatype, allowable_values)
|
135
|
-
@allowable_values = allowable_values.map do |value|
|
136
|
-
case datatype.to_s
|
137
|
-
when /Integer/i
|
138
|
-
value.to_i
|
139
|
-
when /Float/i
|
140
|
-
value.to_f
|
141
|
-
else
|
142
|
-
value
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def valid?(value)
|
148
|
-
!value || allowable_values.include?(value)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
153
|
-
def self.attribute_map
|
154
|
-
{
|
155
|
-
:attributes_to_retrieve => :attributesToRetrieve,
|
156
|
-
:ranking => :ranking,
|
157
|
-
:custom_ranking => :customRanking,
|
158
|
-
:relevancy_strictness => :relevancyStrictness,
|
159
|
-
:attributes_to_highlight => :attributesToHighlight,
|
160
|
-
:attributes_to_snippet => :attributesToSnippet,
|
161
|
-
:highlight_pre_tag => :highlightPreTag,
|
162
|
-
:highlight_post_tag => :highlightPostTag,
|
163
|
-
:snippet_ellipsis_text => :snippetEllipsisText,
|
164
|
-
:restrict_highlight_and_snippet_arrays => :restrictHighlightAndSnippetArrays,
|
165
|
-
:hits_per_page => :hitsPerPage,
|
166
|
-
:min_word_sizefor1_typo => :minWordSizefor1Typo,
|
167
|
-
:min_word_sizefor2_typos => :minWordSizefor2Typos,
|
168
|
-
:typo_tolerance => :typoTolerance,
|
169
|
-
:allow_typos_on_numeric_tokens => :allowTyposOnNumericTokens,
|
170
|
-
:disable_typo_tolerance_on_attributes => :disableTypoToleranceOnAttributes,
|
171
|
-
:ignore_plurals => :ignorePlurals,
|
172
|
-
:remove_stop_words => :removeStopWords,
|
173
|
-
:keep_diacritics_on_characters => :keepDiacriticsOnCharacters,
|
174
|
-
:query_languages => :queryLanguages,
|
175
|
-
:decompound_query => :decompoundQuery,
|
176
|
-
:enable_rules => :enableRules,
|
177
|
-
:enable_personalization => :enablePersonalization,
|
178
|
-
:query_type => :queryType,
|
179
|
-
:remove_words_if_no_results => :removeWordsIfNoResults,
|
180
|
-
:mode => :mode,
|
181
|
-
:semantic_search => :semanticSearch,
|
182
|
-
:advanced_syntax => :advancedSyntax,
|
183
|
-
:optional_words => :optionalWords,
|
184
|
-
:disable_exact_on_attributes => :disableExactOnAttributes,
|
185
|
-
:exact_on_single_word_query => :exactOnSingleWordQuery,
|
186
|
-
:alternatives_as_exact => :alternativesAsExact,
|
187
|
-
:advanced_syntax_features => :advancedSyntaxFeatures,
|
188
|
-
:distinct => :distinct,
|
189
|
-
:replace_synonyms_in_highlight => :replaceSynonymsInHighlight,
|
190
|
-
:min_proximity => :minProximity,
|
191
|
-
:response_fields => :responseFields,
|
192
|
-
:max_facet_hits => :maxFacetHits,
|
193
|
-
:max_values_per_facet => :maxValuesPerFacet,
|
194
|
-
:sort_facet_values_by => :sortFacetValuesBy,
|
195
|
-
:attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity,
|
196
|
-
:rendering_content => :renderingContent,
|
197
|
-
:enable_re_ranking => :enableReRanking,
|
198
|
-
:re_ranking_apply_filter => :reRankingApplyFilter
|
199
|
-
}
|
200
|
-
end
|
201
|
-
|
202
|
-
# Returns all the JSON keys this model knows about
|
203
|
-
def self.acceptable_attributes
|
204
|
-
attribute_map.values
|
205
|
-
end
|
206
|
-
|
207
|
-
# Attribute type mapping.
|
208
|
-
def self.types_mapping
|
209
|
-
{
|
210
|
-
:attributes_to_retrieve => :"Array<String>",
|
211
|
-
:ranking => :"Array<String>",
|
212
|
-
:custom_ranking => :"Array<String>",
|
213
|
-
:relevancy_strictness => :"Integer",
|
214
|
-
:attributes_to_highlight => :"Array<String>",
|
215
|
-
:attributes_to_snippet => :"Array<String>",
|
216
|
-
:highlight_pre_tag => :"String",
|
217
|
-
:highlight_post_tag => :"String",
|
218
|
-
:snippet_ellipsis_text => :"String",
|
219
|
-
:restrict_highlight_and_snippet_arrays => :"Boolean",
|
220
|
-
:hits_per_page => :"Integer",
|
221
|
-
:min_word_sizefor1_typo => :"Integer",
|
222
|
-
:min_word_sizefor2_typos => :"Integer",
|
223
|
-
:typo_tolerance => :"TypoTolerance",
|
224
|
-
:allow_typos_on_numeric_tokens => :"Boolean",
|
225
|
-
:disable_typo_tolerance_on_attributes => :"Array<String>",
|
226
|
-
:ignore_plurals => :"IgnorePlurals",
|
227
|
-
:remove_stop_words => :"RemoveStopWords",
|
228
|
-
:keep_diacritics_on_characters => :"String",
|
229
|
-
:query_languages => :"Array<SupportedLanguage>",
|
230
|
-
:decompound_query => :"Boolean",
|
231
|
-
:enable_rules => :"Boolean",
|
232
|
-
:enable_personalization => :"Boolean",
|
233
|
-
:query_type => :"QueryType",
|
234
|
-
:remove_words_if_no_results => :"RemoveWordsIfNoResults",
|
235
|
-
:mode => :"Mode",
|
236
|
-
:semantic_search => :"SemanticSearch",
|
237
|
-
:advanced_syntax => :"Boolean",
|
238
|
-
:optional_words => :"Array<String>",
|
239
|
-
:disable_exact_on_attributes => :"Array<String>",
|
240
|
-
:exact_on_single_word_query => :"ExactOnSingleWordQuery",
|
241
|
-
:alternatives_as_exact => :"Array<AlternativesAsExact>",
|
242
|
-
:advanced_syntax_features => :"Array<AdvancedSyntaxFeatures>",
|
243
|
-
:distinct => :"Distinct",
|
244
|
-
:replace_synonyms_in_highlight => :"Boolean",
|
245
|
-
:min_proximity => :"Integer",
|
246
|
-
:response_fields => :"Array<String>",
|
247
|
-
:max_facet_hits => :"Integer",
|
248
|
-
:max_values_per_facet => :"Integer",
|
249
|
-
:sort_facet_values_by => :"String",
|
250
|
-
:attribute_criteria_computed_by_min_proximity => :"Boolean",
|
251
|
-
:rendering_content => :"RenderingContent",
|
252
|
-
:enable_re_ranking => :"Boolean",
|
253
|
-
:re_ranking_apply_filter => :"ReRankingApplyFilter"
|
254
|
-
}
|
255
|
-
end
|
256
|
-
|
257
|
-
# List of attributes with nullable: true
|
258
|
-
def self.openapi_nullable
|
259
|
-
Set.new(
|
260
|
-
[
|
261
|
-
:re_ranking_apply_filter
|
262
|
-
]
|
263
|
-
)
|
264
|
-
end
|
265
|
-
|
266
|
-
# Initializes the object
|
267
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
268
|
-
def initialize(attributes = {})
|
269
|
-
if (!attributes.is_a?(Hash))
|
270
|
-
raise(
|
271
|
-
ArgumentError,
|
272
|
-
"The input argument (attributes) must be a hash in `Algolia::IndexSettingsAsSearchParams` initialize method"
|
273
|
-
)
|
274
|
-
end
|
275
|
-
|
276
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
277
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
278
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
279
|
-
raise(
|
280
|
-
ArgumentError,
|
281
|
-
"`#{k}` is not a valid attribute in `Algolia::IndexSettingsAsSearchParams`. Please check the name to make sure it's valid. List of attributes: " +
|
282
|
-
self.class.attribute_map.keys.inspect
|
283
|
-
)
|
284
|
-
end
|
285
|
-
|
286
|
-
h[k.to_sym] = v
|
287
|
-
}
|
288
|
-
|
289
|
-
if attributes.key?(:attributes_to_retrieve)
|
290
|
-
if (value = attributes[:attributes_to_retrieve]).is_a?(Array)
|
291
|
-
self.attributes_to_retrieve = value
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
if attributes.key?(:ranking)
|
296
|
-
if (value = attributes[:ranking]).is_a?(Array)
|
297
|
-
self.ranking = value
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
if attributes.key?(:custom_ranking)
|
302
|
-
if (value = attributes[:custom_ranking]).is_a?(Array)
|
303
|
-
self.custom_ranking = value
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
if attributes.key?(:relevancy_strictness)
|
308
|
-
self.relevancy_strictness = attributes[:relevancy_strictness]
|
309
|
-
end
|
310
|
-
|
311
|
-
if attributes.key?(:attributes_to_highlight)
|
312
|
-
if (value = attributes[:attributes_to_highlight]).is_a?(Array)
|
313
|
-
self.attributes_to_highlight = value
|
314
|
-
end
|
315
|
-
end
|
316
|
-
|
317
|
-
if attributes.key?(:attributes_to_snippet)
|
318
|
-
if (value = attributes[:attributes_to_snippet]).is_a?(Array)
|
319
|
-
self.attributes_to_snippet = value
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
|
-
if attributes.key?(:highlight_pre_tag)
|
324
|
-
self.highlight_pre_tag = attributes[:highlight_pre_tag]
|
325
|
-
end
|
326
|
-
|
327
|
-
if attributes.key?(:highlight_post_tag)
|
328
|
-
self.highlight_post_tag = attributes[:highlight_post_tag]
|
329
|
-
end
|
330
|
-
|
331
|
-
if attributes.key?(:snippet_ellipsis_text)
|
332
|
-
self.snippet_ellipsis_text = attributes[:snippet_ellipsis_text]
|
333
|
-
end
|
334
|
-
|
335
|
-
if attributes.key?(:restrict_highlight_and_snippet_arrays)
|
336
|
-
self.restrict_highlight_and_snippet_arrays = attributes[:restrict_highlight_and_snippet_arrays]
|
337
|
-
end
|
338
|
-
|
339
|
-
if attributes.key?(:hits_per_page)
|
340
|
-
self.hits_per_page = attributes[:hits_per_page]
|
341
|
-
end
|
342
|
-
|
343
|
-
if attributes.key?(:min_word_sizefor1_typo)
|
344
|
-
self.min_word_sizefor1_typo = attributes[:min_word_sizefor1_typo]
|
345
|
-
end
|
346
|
-
|
347
|
-
if attributes.key?(:min_word_sizefor2_typos)
|
348
|
-
self.min_word_sizefor2_typos = attributes[:min_word_sizefor2_typos]
|
349
|
-
end
|
350
|
-
|
351
|
-
if attributes.key?(:typo_tolerance)
|
352
|
-
self.typo_tolerance = attributes[:typo_tolerance]
|
353
|
-
end
|
354
|
-
|
355
|
-
if attributes.key?(:allow_typos_on_numeric_tokens)
|
356
|
-
self.allow_typos_on_numeric_tokens = attributes[:allow_typos_on_numeric_tokens]
|
357
|
-
end
|
358
|
-
|
359
|
-
if attributes.key?(:disable_typo_tolerance_on_attributes)
|
360
|
-
if (value = attributes[:disable_typo_tolerance_on_attributes]).is_a?(Array)
|
361
|
-
self.disable_typo_tolerance_on_attributes = value
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
|
-
if attributes.key?(:ignore_plurals)
|
366
|
-
self.ignore_plurals = attributes[:ignore_plurals]
|
367
|
-
end
|
368
|
-
|
369
|
-
if attributes.key?(:remove_stop_words)
|
370
|
-
self.remove_stop_words = attributes[:remove_stop_words]
|
371
|
-
end
|
372
|
-
|
373
|
-
if attributes.key?(:keep_diacritics_on_characters)
|
374
|
-
self.keep_diacritics_on_characters = attributes[:keep_diacritics_on_characters]
|
375
|
-
end
|
376
|
-
|
377
|
-
if attributes.key?(:query_languages)
|
378
|
-
if (value = attributes[:query_languages]).is_a?(Array)
|
379
|
-
self.query_languages = value
|
380
|
-
end
|
381
|
-
end
|
382
|
-
|
383
|
-
if attributes.key?(:decompound_query)
|
384
|
-
self.decompound_query = attributes[:decompound_query]
|
385
|
-
end
|
386
|
-
|
387
|
-
if attributes.key?(:enable_rules)
|
388
|
-
self.enable_rules = attributes[:enable_rules]
|
389
|
-
end
|
390
|
-
|
391
|
-
if attributes.key?(:enable_personalization)
|
392
|
-
self.enable_personalization = attributes[:enable_personalization]
|
393
|
-
end
|
394
|
-
|
395
|
-
if attributes.key?(:query_type)
|
396
|
-
self.query_type = attributes[:query_type]
|
397
|
-
end
|
398
|
-
|
399
|
-
if attributes.key?(:remove_words_if_no_results)
|
400
|
-
self.remove_words_if_no_results = attributes[:remove_words_if_no_results]
|
401
|
-
end
|
402
|
-
|
403
|
-
if attributes.key?(:mode)
|
404
|
-
self.mode = attributes[:mode]
|
405
|
-
end
|
406
|
-
|
407
|
-
if attributes.key?(:semantic_search)
|
408
|
-
self.semantic_search = attributes[:semantic_search]
|
409
|
-
end
|
410
|
-
|
411
|
-
if attributes.key?(:advanced_syntax)
|
412
|
-
self.advanced_syntax = attributes[:advanced_syntax]
|
413
|
-
end
|
414
|
-
|
415
|
-
if attributes.key?(:optional_words)
|
416
|
-
if (value = attributes[:optional_words]).is_a?(Array)
|
417
|
-
self.optional_words = value
|
418
|
-
end
|
419
|
-
end
|
420
|
-
|
421
|
-
if attributes.key?(:disable_exact_on_attributes)
|
422
|
-
if (value = attributes[:disable_exact_on_attributes]).is_a?(Array)
|
423
|
-
self.disable_exact_on_attributes = value
|
424
|
-
end
|
425
|
-
end
|
426
|
-
|
427
|
-
if attributes.key?(:exact_on_single_word_query)
|
428
|
-
self.exact_on_single_word_query = attributes[:exact_on_single_word_query]
|
429
|
-
end
|
430
|
-
|
431
|
-
if attributes.key?(:alternatives_as_exact)
|
432
|
-
if (value = attributes[:alternatives_as_exact]).is_a?(Array)
|
433
|
-
self.alternatives_as_exact = value
|
434
|
-
end
|
435
|
-
end
|
436
|
-
|
437
|
-
if attributes.key?(:advanced_syntax_features)
|
438
|
-
if (value = attributes[:advanced_syntax_features]).is_a?(Array)
|
439
|
-
self.advanced_syntax_features = value
|
440
|
-
end
|
441
|
-
end
|
442
|
-
|
443
|
-
if attributes.key?(:distinct)
|
444
|
-
self.distinct = attributes[:distinct]
|
445
|
-
end
|
446
|
-
|
447
|
-
if attributes.key?(:replace_synonyms_in_highlight)
|
448
|
-
self.replace_synonyms_in_highlight = attributes[:replace_synonyms_in_highlight]
|
449
|
-
end
|
450
|
-
|
451
|
-
if attributes.key?(:min_proximity)
|
452
|
-
self.min_proximity = attributes[:min_proximity]
|
453
|
-
end
|
454
|
-
|
455
|
-
if attributes.key?(:response_fields)
|
456
|
-
if (value = attributes[:response_fields]).is_a?(Array)
|
457
|
-
self.response_fields = value
|
458
|
-
end
|
459
|
-
end
|
460
|
-
|
461
|
-
if attributes.key?(:max_facet_hits)
|
462
|
-
self.max_facet_hits = attributes[:max_facet_hits]
|
463
|
-
end
|
464
|
-
|
465
|
-
if attributes.key?(:max_values_per_facet)
|
466
|
-
self.max_values_per_facet = attributes[:max_values_per_facet]
|
467
|
-
end
|
468
|
-
|
469
|
-
if attributes.key?(:sort_facet_values_by)
|
470
|
-
self.sort_facet_values_by = attributes[:sort_facet_values_by]
|
471
|
-
end
|
472
|
-
|
473
|
-
if attributes.key?(:attribute_criteria_computed_by_min_proximity)
|
474
|
-
self.attribute_criteria_computed_by_min_proximity = attributes[:attribute_criteria_computed_by_min_proximity]
|
475
|
-
end
|
476
|
-
|
477
|
-
if attributes.key?(:rendering_content)
|
478
|
-
self.rendering_content = attributes[:rendering_content]
|
479
|
-
end
|
480
|
-
|
481
|
-
if attributes.key?(:enable_re_ranking)
|
482
|
-
self.enable_re_ranking = attributes[:enable_re_ranking]
|
483
|
-
end
|
484
|
-
|
485
|
-
if attributes.key?(:re_ranking_apply_filter)
|
486
|
-
self.re_ranking_apply_filter = attributes[:re_ranking_apply_filter]
|
487
|
-
end
|
488
|
-
end
|
489
|
-
|
490
|
-
# Custom attribute writer method with validation
|
491
|
-
# @param [Object] hits_per_page Value to be assigned
|
492
|
-
def hits_per_page=(hits_per_page)
|
493
|
-
if hits_per_page.nil?
|
494
|
-
raise ArgumentError, "hits_per_page cannot be nil"
|
495
|
-
end
|
496
|
-
|
497
|
-
if hits_per_page > 1000
|
498
|
-
raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000."
|
499
|
-
end
|
500
|
-
|
501
|
-
if hits_per_page < 1
|
502
|
-
raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1."
|
503
|
-
end
|
504
|
-
|
505
|
-
@hits_per_page = hits_per_page
|
506
|
-
end
|
507
|
-
|
508
|
-
# Custom attribute writer method with validation
|
509
|
-
# @param [Object] min_proximity Value to be assigned
|
510
|
-
def min_proximity=(min_proximity)
|
511
|
-
if min_proximity.nil?
|
512
|
-
raise ArgumentError, "min_proximity cannot be nil"
|
513
|
-
end
|
514
|
-
|
515
|
-
if min_proximity > 7
|
516
|
-
raise ArgumentError, "invalid value for \"min_proximity\", must be smaller than or equal to 7."
|
517
|
-
end
|
518
|
-
|
519
|
-
if min_proximity < 1
|
520
|
-
raise ArgumentError, "invalid value for \"min_proximity\", must be greater than or equal to 1."
|
521
|
-
end
|
522
|
-
|
523
|
-
@min_proximity = min_proximity
|
524
|
-
end
|
525
|
-
|
526
|
-
# Custom attribute writer method with validation
|
527
|
-
# @param [Object] max_facet_hits Value to be assigned
|
528
|
-
def max_facet_hits=(max_facet_hits)
|
529
|
-
if max_facet_hits.nil?
|
530
|
-
raise ArgumentError, "max_facet_hits cannot be nil"
|
531
|
-
end
|
532
|
-
|
533
|
-
if max_facet_hits > 100
|
534
|
-
raise ArgumentError, "invalid value for \"max_facet_hits\", must be smaller than or equal to 100."
|
535
|
-
end
|
536
|
-
|
537
|
-
@max_facet_hits = max_facet_hits
|
538
|
-
end
|
539
|
-
|
540
|
-
# Custom attribute writer method with validation
|
541
|
-
# @param [Object] max_values_per_facet Value to be assigned
|
542
|
-
def max_values_per_facet=(max_values_per_facet)
|
543
|
-
if max_values_per_facet.nil?
|
544
|
-
raise ArgumentError, "max_values_per_facet cannot be nil"
|
545
|
-
end
|
546
|
-
|
547
|
-
if max_values_per_facet > 1000
|
548
|
-
raise ArgumentError, "invalid value for \"max_values_per_facet\", must be smaller than or equal to 1000."
|
549
|
-
end
|
550
|
-
|
551
|
-
@max_values_per_facet = max_values_per_facet
|
552
|
-
end
|
553
|
-
|
554
|
-
# Checks equality by comparing each attribute.
|
555
|
-
# @param [Object] Object to be compared
|
556
|
-
def ==(other)
|
557
|
-
return true if self.equal?(other)
|
558
|
-
self.class == other.class &&
|
559
|
-
attributes_to_retrieve == other.attributes_to_retrieve &&
|
560
|
-
ranking == other.ranking &&
|
561
|
-
custom_ranking == other.custom_ranking &&
|
562
|
-
relevancy_strictness == other.relevancy_strictness &&
|
563
|
-
attributes_to_highlight == other.attributes_to_highlight &&
|
564
|
-
attributes_to_snippet == other.attributes_to_snippet &&
|
565
|
-
highlight_pre_tag == other.highlight_pre_tag &&
|
566
|
-
highlight_post_tag == other.highlight_post_tag &&
|
567
|
-
snippet_ellipsis_text == other.snippet_ellipsis_text &&
|
568
|
-
restrict_highlight_and_snippet_arrays == other.restrict_highlight_and_snippet_arrays &&
|
569
|
-
hits_per_page == other.hits_per_page &&
|
570
|
-
min_word_sizefor1_typo == other.min_word_sizefor1_typo &&
|
571
|
-
min_word_sizefor2_typos == other.min_word_sizefor2_typos &&
|
572
|
-
typo_tolerance == other.typo_tolerance &&
|
573
|
-
allow_typos_on_numeric_tokens == other.allow_typos_on_numeric_tokens &&
|
574
|
-
disable_typo_tolerance_on_attributes == other.disable_typo_tolerance_on_attributes &&
|
575
|
-
ignore_plurals == other.ignore_plurals &&
|
576
|
-
remove_stop_words == other.remove_stop_words &&
|
577
|
-
keep_diacritics_on_characters == other.keep_diacritics_on_characters &&
|
578
|
-
query_languages == other.query_languages &&
|
579
|
-
decompound_query == other.decompound_query &&
|
580
|
-
enable_rules == other.enable_rules &&
|
581
|
-
enable_personalization == other.enable_personalization &&
|
582
|
-
query_type == other.query_type &&
|
583
|
-
remove_words_if_no_results == other.remove_words_if_no_results &&
|
584
|
-
mode == other.mode &&
|
585
|
-
semantic_search == other.semantic_search &&
|
586
|
-
advanced_syntax == other.advanced_syntax &&
|
587
|
-
optional_words == other.optional_words &&
|
588
|
-
disable_exact_on_attributes == other.disable_exact_on_attributes &&
|
589
|
-
exact_on_single_word_query == other.exact_on_single_word_query &&
|
590
|
-
alternatives_as_exact == other.alternatives_as_exact &&
|
591
|
-
advanced_syntax_features == other.advanced_syntax_features &&
|
592
|
-
distinct == other.distinct &&
|
593
|
-
replace_synonyms_in_highlight == other.replace_synonyms_in_highlight &&
|
594
|
-
min_proximity == other.min_proximity &&
|
595
|
-
response_fields == other.response_fields &&
|
596
|
-
max_facet_hits == other.max_facet_hits &&
|
597
|
-
max_values_per_facet == other.max_values_per_facet &&
|
598
|
-
sort_facet_values_by == other.sort_facet_values_by &&
|
599
|
-
attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity &&
|
600
|
-
rendering_content == other.rendering_content &&
|
601
|
-
enable_re_ranking == other.enable_re_ranking &&
|
602
|
-
re_ranking_apply_filter == other.re_ranking_apply_filter
|
603
|
-
end
|
604
|
-
|
605
|
-
# @see the `==` method
|
606
|
-
# @param [Object] Object to be compared
|
607
|
-
def eql?(other)
|
608
|
-
self == other
|
609
|
-
end
|
610
|
-
|
611
|
-
# Calculates hash code according to all attributes.
|
612
|
-
# @return [Integer] Hash code
|
613
|
-
def hash
|
614
|
-
[
|
615
|
-
attributes_to_retrieve,
|
616
|
-
ranking,
|
617
|
-
custom_ranking,
|
618
|
-
relevancy_strictness,
|
619
|
-
attributes_to_highlight,
|
620
|
-
attributes_to_snippet,
|
621
|
-
highlight_pre_tag,
|
622
|
-
highlight_post_tag,
|
623
|
-
snippet_ellipsis_text,
|
624
|
-
restrict_highlight_and_snippet_arrays,
|
625
|
-
hits_per_page,
|
626
|
-
min_word_sizefor1_typo,
|
627
|
-
min_word_sizefor2_typos,
|
628
|
-
typo_tolerance,
|
629
|
-
allow_typos_on_numeric_tokens,
|
630
|
-
disable_typo_tolerance_on_attributes,
|
631
|
-
ignore_plurals,
|
632
|
-
remove_stop_words,
|
633
|
-
keep_diacritics_on_characters,
|
634
|
-
query_languages,
|
635
|
-
decompound_query,
|
636
|
-
enable_rules,
|
637
|
-
enable_personalization,
|
638
|
-
query_type,
|
639
|
-
remove_words_if_no_results,
|
640
|
-
mode,
|
641
|
-
semantic_search,
|
642
|
-
advanced_syntax,
|
643
|
-
optional_words,
|
644
|
-
disable_exact_on_attributes,
|
645
|
-
exact_on_single_word_query,
|
646
|
-
alternatives_as_exact,
|
647
|
-
advanced_syntax_features,
|
648
|
-
distinct,
|
649
|
-
replace_synonyms_in_highlight,
|
650
|
-
min_proximity,
|
651
|
-
response_fields,
|
652
|
-
max_facet_hits,
|
653
|
-
max_values_per_facet,
|
654
|
-
sort_facet_values_by,
|
655
|
-
attribute_criteria_computed_by_min_proximity,
|
656
|
-
rendering_content,
|
657
|
-
enable_re_ranking,
|
658
|
-
re_ranking_apply_filter
|
659
|
-
].hash
|
660
|
-
end
|
661
|
-
|
662
|
-
# Builds the object from hash
|
663
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
664
|
-
# @return [Object] Returns the model itself
|
665
|
-
def self.build_from_hash(attributes)
|
666
|
-
return nil unless attributes.is_a?(Hash)
|
667
|
-
attributes = attributes.transform_keys(&:to_sym)
|
668
|
-
transformed_hash = {}
|
669
|
-
types_mapping.each_pair do |key, type|
|
670
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
671
|
-
transformed_hash[key.to_sym] = nil
|
672
|
-
elsif type =~ /\AArray<(.*)>/i
|
673
|
-
# check to ensure the input is an array given that the attribute
|
674
|
-
# is documented as an array but the input is not
|
675
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
676
|
-
transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
|
677
|
-
_deserialize(::Regexp.last_match(1), v)
|
678
|
-
}
|
679
|
-
end
|
680
|
-
elsif !attributes[attribute_map[key]].nil?
|
681
|
-
transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
|
682
|
-
end
|
683
|
-
end
|
684
|
-
|
685
|
-
new(transformed_hash)
|
686
|
-
end
|
687
|
-
|
688
|
-
# Deserializes the data based on type
|
689
|
-
# @param string type Data type
|
690
|
-
# @param string value Value to be deserialized
|
691
|
-
# @return [Object] Deserialized data
|
692
|
-
def self._deserialize(type, value)
|
693
|
-
case type.to_sym
|
694
|
-
when :Time
|
695
|
-
Time.parse(value)
|
696
|
-
when :Date
|
697
|
-
Date.parse(value)
|
698
|
-
when :String
|
699
|
-
value.to_s
|
700
|
-
when :Integer
|
701
|
-
value.to_i
|
702
|
-
when :Float
|
703
|
-
value.to_f
|
704
|
-
when :Boolean
|
705
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
706
|
-
true
|
707
|
-
else
|
708
|
-
false
|
709
|
-
end
|
710
|
-
|
711
|
-
when :Object
|
712
|
-
# generic object (usually a Hash), return directly
|
713
|
-
value
|
714
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
715
|
-
inner_type = Regexp.last_match[:inner_type]
|
716
|
-
value.map { |v| _deserialize(inner_type, v) }
|
717
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
718
|
-
k_type = Regexp.last_match[:k_type]
|
719
|
-
v_type = Regexp.last_match[:v_type]
|
720
|
-
{}.tap do |hash|
|
721
|
-
value.each do |k, v|
|
722
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
723
|
-
end
|
724
|
-
end
|
725
|
-
# model
|
726
|
-
else
|
727
|
-
# models (e.g. Pet) or oneOf
|
728
|
-
klass = Algolia::Search.const_get(type)
|
729
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
|
730
|
-
.build_from_hash(value)
|
731
|
-
end
|
732
|
-
end
|
733
|
-
|
734
|
-
# Returns the string representation of the object
|
735
|
-
# @return [String] String presentation of the object
|
736
|
-
def to_s
|
737
|
-
to_hash.to_s
|
738
|
-
end
|
739
|
-
|
740
|
-
# to_body is an alias to to_hash (backward compatibility)
|
741
|
-
# @return [Hash] Returns the object in the form of hash
|
742
|
-
def to_body
|
743
|
-
to_hash
|
744
|
-
end
|
745
|
-
|
746
|
-
def to_json(*_args)
|
747
|
-
to_hash.to_json
|
748
|
-
end
|
749
|
-
|
750
|
-
# Returns the object in the form of hash
|
751
|
-
# @return [Hash] Returns the object in the form of hash
|
752
|
-
def to_hash
|
753
|
-
hash = {}
|
754
|
-
self.class.attribute_map.each_pair do |attr, param|
|
755
|
-
value = send(attr)
|
756
|
-
if value.nil?
|
757
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
758
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
759
|
-
end
|
760
|
-
|
761
|
-
hash[param] = _to_hash(value)
|
762
|
-
end
|
763
|
-
|
764
|
-
hash
|
765
|
-
end
|
766
|
-
|
767
|
-
# Outputs non-array value in the form of hash
|
768
|
-
# For object, use to_hash. Otherwise, just return the value
|
769
|
-
# @param [Object] value Any valid value
|
770
|
-
# @return [Hash] Returns the value in the form of hash
|
771
|
-
def _to_hash(value)
|
772
|
-
if value.is_a?(Array)
|
773
|
-
value.compact.map { |v| _to_hash(v) }
|
774
|
-
elsif value.is_a?(Hash)
|
775
|
-
{}.tap do |hash|
|
776
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
777
|
-
end
|
778
|
-
elsif value.respond_to?(:to_hash)
|
779
|
-
value.to_hash
|
780
|
-
else
|
781
|
-
value
|
782
|
-
end
|
783
|
-
end
|
784
|
-
|
785
|
-
end
|
786
|
-
|
787
|
-
end
|
788
|
-
end
|