algolia 3.45.0 → 3.46.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +2 -2
- data/AGENTS.md +0 -24
- data/CHANGELOG.md +30 -0
- data/Gemfile.lock +1 -1
- data/lib/algolia/api/abtesting_v3_client.rb +196 -7
- data/lib/algolia/api/agent_studio_client.rb +244 -6
- data/lib/algolia/api/recommend_client.rb +2 -2
- data/lib/algolia/api/search_client.rb +17 -3
- data/lib/algolia/configuration.rb +8 -0
- data/lib/algolia/defaults.rb +8 -0
- data/lib/algolia/models/abtesting-v3/ab_test.rb +25 -1
- data/lib/algolia/models/abtesting-v3/ab_test_configuration.rb +22 -4
- data/lib/algolia/models/abtesting-v3/ab_test_settings_response.rb +224 -0
- data/lib/algolia/models/abtesting-v3/add_ab_tests_request.rb +11 -1
- data/lib/algolia/models/abtesting-v3/analysis_method.rb +34 -0
- data/lib/algolia/models/abtesting-v3/bayesian_metric_result.rb +237 -0
- data/lib/algolia/models/abtesting-v3/evidence_status.rb +37 -0
- data/lib/algolia/models/abtesting-v3/feature_settings.rb +224 -0
- data/lib/algolia/models/abtesting-v3/metric_evidence.rb +209 -0
- data/lib/algolia/models/abtesting-v3/metric_metadata.rb +1 -1
- data/lib/algolia/models/abtesting-v3/metric_name.rb +7 -1
- data/lib/algolia/models/abtesting-v3/metric_result.rb +18 -8
- data/lib/algolia/models/abtesting-v3/minimum_detectable_effect.rb +1 -1
- data/lib/algolia/models/abtesting-v3/primary_metric.rb +37 -0
- data/lib/algolia/models/abtesting-v3/save_settings_request.rb +208 -0
- data/lib/algolia/models/abtesting-v3/variant_settings.rb +293 -0
- data/lib/algolia/models/agent-studio/agent_completion_algolia_params.rb +16 -4
- data/lib/algolia/models/agent-studio/agent_completion_request.rb +1 -3
- data/lib/algolia/models/agent-studio/agent_completion_request_union.rb +108 -0
- data/lib/algolia/models/agent-studio/agent_test_configuration.rb +1 -1
- data/lib/algolia/models/agent-studio/agent_with_version_response.rb +1 -1
- data/lib/algolia/models/agent-studio/agui_completion_request.rb +265 -0
- data/lib/algolia/models/agent-studio/agui_resume.rb +231 -0
- data/lib/algolia/models/agent-studio/algolia_grouped_results_compat_tool_config.rb +268 -0
- data/lib/algolia/models/agent-studio/{algolia_display_results_tool_config.rb → algolia_grouped_results_tool_config.rb} +30 -16
- data/lib/algolia/models/agent-studio/{algolia_recommend_tool_config_input.rb → algolia_recommend_tool_config.rb} +3 -3
- data/lib/algolia/models/agent-studio/algolia_search_tool_config.rb +22 -4
- data/lib/algolia/models/agent-studio/assistant_message_agui.rb +280 -0
- data/lib/algolia/models/agent-studio/assistant_message_v4.rb +1 -0
- data/lib/algolia/models/agent-studio/assistant_message_v5.rb +3 -1
- data/lib/algolia/models/agent-studio/assistant_part_v5.rb +2 -0
- data/lib/algolia/models/agent-studio/azure_open_ai_provider_input.rb +1 -1
- data/lib/algolia/models/agent-studio/boolean_param.rb +220 -0
- data/lib/algolia/models/agent-studio/client_side_tool_config.rb +14 -4
- data/lib/algolia/models/agent-studio/compaction_stats.rb +271 -0
- data/lib/algolia/models/agent-studio/compatibility_mode.rb +2 -1
- data/lib/algolia/models/agent-studio/context_compact_request.rb +263 -0
- data/lib/algolia/models/agent-studio/context_response.rb +231 -0
- data/lib/algolia/models/agent-studio/context_stats.rb +258 -0
- data/lib/algolia/models/agent-studio/context_trim_request.rb +239 -0
- data/lib/algolia/models/agent-studio/conversation_base_response.rb +16 -5
- data/lib/algolia/models/agent-studio/conversation_full_response.rb +26 -5
- data/lib/algolia/models/agent-studio/data_guardrail_violation_part_v5.rb +218 -0
- data/lib/algolia/models/agent-studio/data_part_v5.rb +220 -0
- data/lib/algolia/models/agent-studio/facet_filters_union_search_parameters_overrides.rb +108 -0
- data/lib/algolia/models/agent-studio/feedback_update_request.rb +253 -0
- data/lib/algolia/models/agent-studio/forwarded_props.rb +226 -0
- data/lib/algolia/models/agent-studio/function_call_agui.rb +219 -0
- data/lib/algolia/models/agent-studio/guardrail_outcome.rb +231 -0
- data/lib/algolia/models/agent-studio/guardrail_violation_data_v5.rb +230 -0
- data/lib/algolia/models/agent-studio/impact_analytics.rb +242 -0
- data/lib/algolia/models/agent-studio/index_search_parameters.rb +11 -1
- data/lib/algolia/models/agent-studio/input_union.rb +113 -0
- data/lib/algolia/models/agent-studio/items_union.rb +132 -0
- data/lib/algolia/models/agent-studio/items_union_agui_completion_request.rb +123 -0
- data/lib/algolia/models/agent-studio/managed_provider_response_input.rb +209 -0
- data/lib/algolia/models/agent-studio/mcp_server_tool_config.rb +1 -1
- data/lib/algolia/models/agent-studio/memory_record.rb +4 -4
- data/lib/algolia/models/agent-studio/message_event.rb +231 -0
- data/lib/algolia/models/agent-studio/message_part_assistant_message_agui.rb +123 -0
- data/lib/algolia/models/agent-studio/message_response.rb +87 -5
- data/lib/algolia/models/agent-studio/mode_enum.rb +34 -0
- data/lib/algolia/models/agent-studio/one_of_enum.rb +34 -0
- data/lib/algolia/models/agent-studio/open_ai_compatible_provider_input.rb +1 -1
- data/lib/algolia/models/agent-studio/paginated_conversations_response.rb +13 -4
- data/lib/algolia/models/agent-studio/provider_authentication_response.rb +14 -5
- data/lib/algolia/models/agent-studio/provider_input.rb +2 -1
- data/lib/algolia/models/agent-studio/provider_input_nullable.rb +2 -1
- data/lib/algolia/models/agent-studio/provider_name.rb +2 -1
- data/lib/algolia/models/agent-studio/reasoning_message_agui.rb +239 -0
- data/lib/algolia/models/agent-studio/reasoning_part_agui.rb +228 -0
- data/lib/algolia/models/agent-studio/search_parameters.rb +1 -1
- data/lib/algolia/models/agent-studio/search_parameters_overrides.rb +80 -5
- data/lib/algolia/models/agent-studio/status_enum.rb +34 -0
- data/lib/algolia/models/agent-studio/task_kind.rb +33 -0
- data/lib/algolia/models/agent-studio/task_request.rb +240 -0
- data/lib/algolia/models/agent-studio/task_response.rb +211 -0
- data/lib/algolia/models/agent-studio/text_part_agui.rb +219 -0
- data/lib/algolia/models/agent-studio/tool_approval_agui.rb +228 -0
- data/lib/algolia/models/agent-studio/tool_approval_request_part.rb +15 -5
- data/lib/algolia/models/agent-studio/tool_call_agui.rb +237 -0
- data/lib/algolia/models/agent-studio/tool_call_part.rb +13 -1
- data/lib/algolia/models/agent-studio/tool_call_part_agui.rb +272 -0
- data/lib/algolia/models/agent-studio/tool_call_result_part_agui.rb +250 -0
- data/lib/algolia/models/agent-studio/tool_config_input.rb +2 -5
- data/lib/algolia/models/agent-studio/{tool_config.rb → tool_config_or_boolean_union.rb} +1 -1
- data/lib/algolia/models/agent-studio/tool_config_output.rb +126 -0
- data/lib/algolia/models/agent-studio/tool_invocation_v4.rb +10 -2
- data/lib/algolia/models/agent-studio/tool_message_agui.rb +259 -0
- data/lib/algolia/models/agent-studio/tool_part_v5.rb +47 -2
- data/lib/algolia/models/agent-studio/tool_result_part.rb +57 -5
- data/lib/algolia/models/agent-studio/unknown_tool_config.rb +1 -1
- data/lib/algolia/models/agent-studio/user_message_agui.rb +261 -0
- data/lib/algolia/models/agent-studio/user_message_metadata_agui.rb +208 -0
- data/lib/algolia/models/agent-studio/user_message_metadata_v5.rb +4 -2
- data/lib/algolia/models/agent-studio/user_message_v4.rb +4 -1
- data/lib/algolia/models/agent-studio/user_message_v5.rb +4 -1
- data/lib/algolia/models/agent-studio/validation_error.rb +5 -25
- data/lib/algolia/models/agent-studio/xai_provider_input.rb +220 -0
- data/lib/algolia/models/analytics/catalog_entry.rb +1 -1
- data/lib/algolia/models/composition/base_injection_query_parameters.rb +18 -18
- data/lib/algolia/models/composition/distinct.rb +1 -1
- data/lib/algolia/models/composition/external_provider.rb +209 -0
- data/lib/algolia/models/composition/external_provider_ordering.rb +34 -0
- data/lib/algolia/models/composition/hit_metadata.rb +2 -2
- data/lib/algolia/models/composition/injected_item_external.rb +21 -14
- data/lib/algolia/models/composition/injected_item_external_provider.rb +258 -0
- data/lib/algolia/models/composition/injected_item_external_provider_source.rb +216 -0
- data/lib/algolia/models/composition/injected_item_hits_metadata.rb +1 -1
- data/lib/algolia/models/composition/{recommend.rb → injected_item_recommend.rb} +10 -3
- data/lib/algolia/models/composition/injected_item_recommend_source.rb +1 -1
- data/lib/algolia/models/composition/injected_item_search.rb +8 -1
- data/lib/algolia/models/composition/injected_item_source.rb +1 -0
- data/lib/algolia/models/composition/injection_main_external_provider.rb +258 -0
- data/lib/algolia/models/composition/injection_main_external_provider_source.rb +216 -0
- data/lib/algolia/models/composition/{main_recommend.rb → injection_main_recommend.rb} +10 -3
- data/lib/algolia/models/composition/injection_main_recommend_source.rb +1 -1
- data/lib/algolia/models/composition/{main_search.rb → injection_main_search.rb} +11 -4
- data/lib/algolia/models/composition/injection_main_search_source.rb +1 -1
- data/lib/algolia/models/composition/injection_main_source.rb +1 -0
- data/lib/algolia/models/composition/main_injection_query_parameters.rb +22 -22
- data/lib/algolia/models/composition/optional_words.rb +1 -1
- data/lib/algolia/models/composition/params.rb +6 -6
- data/lib/algolia/models/composition/processing_error.rb +209 -0
- data/lib/algolia/models/composition/request_body.rb +13 -4
- data/lib/algolia/models/composition/result_card.rb +208 -0
- data/lib/algolia/models/composition/search_response.rb +16 -4
- data/lib/algolia/models/composition/widgets.rb +13 -4
- data/lib/algolia/models/ingestion/source_update_commercetools.rb +11 -0
- data/lib/algolia/models/recommend/distinct.rb +1 -1
- data/lib/algolia/models/recommend/fallback_params.rb +26 -26
- data/lib/algolia/models/recommend/optional_words.rb +1 -1
- data/lib/algolia/models/recommend/recommend_search_params.rb +26 -26
- data/lib/algolia/models/recommend/result_card.rb +208 -0
- data/lib/algolia/models/recommend/widgets.rb +13 -4
- data/lib/algolia/models/search/api_key.rb +2 -2
- data/lib/algolia/models/search/attribute_criteria_computed_by.rb +35 -0
- data/lib/algolia/models/search/browse_params_object.rb +35 -25
- data/lib/algolia/models/search/consequence_params.rb +35 -25
- data/lib/algolia/models/search/distinct.rb +1 -1
- data/lib/algolia/models/search/get_api_key_response.rb +2 -2
- data/lib/algolia/models/search/index_settings.rb +28 -18
- data/lib/algolia/models/search/optional_words.rb +1 -1
- data/lib/algolia/models/search/result_card.rb +208 -0
- data/lib/algolia/models/search/search_for_facets.rb +35 -25
- data/lib/algolia/models/search/search_for_hits.rb +35 -25
- data/lib/algolia/models/search/search_params_object.rb +35 -25
- data/lib/algolia/models/search/secured_api_key_restrictions.rb +1 -1
- data/lib/algolia/models/search/settings_response.rb +28 -18
- data/lib/algolia/models/search/widgets.rb +13 -4
- data/lib/algolia/transport/transport.rb +82 -10
- data/lib/algolia/version.rb +1 -1
- metadata +72 -8
|
@@ -12,7 +12,7 @@ module Algolia
|
|
|
12
12
|
# Search query.
|
|
13
13
|
attr_accessor :query
|
|
14
14
|
|
|
15
|
-
# Keywords to be used instead of the search query to conduct a more broader search Using the `similarQuery` parameter changes other settings - `queryType` is set to `prefixNone`. - `removeStopWords` is set to true. - `words` is set as the first ranking criterion. - All remaining words are treated as `optionalWords
|
|
15
|
+
# Keywords to be used instead of the search query to conduct a more broader search. Using the `similarQuery` parameter changes other settings - `queryType` is set to `prefixNone`. - `removeStopWords` is set to true. - `words` is set as the first ranking criterion. - All remaining words are treated as `optionalWords`. Since the `similarQuery` is supposed to do a broad search, they usually return many results. Combine it with `filters` to narrow down the list of results.
|
|
16
16
|
attr_accessor :similar_query
|
|
17
17
|
|
|
18
18
|
# 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 if the facet attribute name or facet value contains 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).
|
|
@@ -26,16 +26,16 @@ module Algolia
|
|
|
26
26
|
|
|
27
27
|
attr_accessor :tag_filters
|
|
28
28
|
|
|
29
|
-
# 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/#
|
|
29
|
+
# 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/#accumulate-scores-with-sumorfiltersscores).
|
|
30
30
|
attr_accessor :sum_or_filters_scores
|
|
31
31
|
|
|
32
32
|
# Restricts a search to a subset of your searchable attributes. Attribute names are case-sensitive.
|
|
33
33
|
attr_accessor :restrict_searchable_attributes
|
|
34
34
|
|
|
35
|
-
# 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).
|
|
35
|
+
# 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).
|
|
36
36
|
attr_accessor :facets
|
|
37
37
|
|
|
38
|
-
# Whether faceting should be applied after deduplication with `distinct
|
|
38
|
+
# 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`.
|
|
39
39
|
attr_accessor :faceting_after_distinct
|
|
40
40
|
|
|
41
41
|
# Page of search results to retrieve.
|
|
@@ -65,13 +65,13 @@ module Algolia
|
|
|
65
65
|
# Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`.
|
|
66
66
|
attr_accessor :inside_polygon
|
|
67
67
|
|
|
68
|
-
# 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`.
|
|
68
|
+
# 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`.
|
|
69
69
|
attr_accessor :natural_languages
|
|
70
70
|
|
|
71
|
-
# 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/#
|
|
71
|
+
# 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/#assign-context) are strings that you can use to trigger matching rules.
|
|
72
72
|
attr_accessor :rule_contexts
|
|
73
73
|
|
|
74
|
-
# 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).
|
|
74
|
+
# 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).
|
|
75
75
|
attr_accessor :personalization_impact
|
|
76
76
|
|
|
77
77
|
# Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken).
|
|
@@ -83,7 +83,7 @@ module Algolia
|
|
|
83
83
|
# Whether to take into account an index's synonyms for this search.
|
|
84
84
|
attr_accessor :synonyms
|
|
85
85
|
|
|
86
|
-
# 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/doc/guides/sending-events/getting-started).
|
|
86
|
+
# 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/doc/guides/sending-events/getting-started).
|
|
87
87
|
attr_accessor :click_analytics
|
|
88
88
|
|
|
89
89
|
# Whether this search will be included in Analytics.
|
|
@@ -98,16 +98,16 @@ module Algolia
|
|
|
98
98
|
# Whether to enable A/B testing for this search.
|
|
99
99
|
attr_accessor :enable_ab_test
|
|
100
100
|
|
|
101
|
-
# 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.
|
|
101
|
+
# 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.
|
|
102
102
|
attr_accessor :attributes_to_retrieve
|
|
103
103
|
|
|
104
104
|
# 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, test your changes in the dashboard, and by [A/B testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing).
|
|
105
105
|
attr_accessor :ranking
|
|
106
106
|
|
|
107
|
-
# 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/#
|
|
107
|
+
# 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/#standard-and-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
|
|
108
108
|
attr_accessor :relevancy_strictness
|
|
109
109
|
|
|
110
|
-
# 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).
|
|
110
|
+
# 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).
|
|
111
111
|
attr_accessor :attributes_to_highlight
|
|
112
112
|
|
|
113
113
|
# 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.
|
|
@@ -128,18 +128,18 @@ module Algolia
|
|
|
128
128
|
# Number of hits per page.
|
|
129
129
|
attr_accessor :hits_per_page
|
|
130
130
|
|
|
131
|
-
# 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/#
|
|
131
|
+
# 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/#configure-word-size-threshold-for-typos).
|
|
132
132
|
attr_accessor :min_word_sizefor1_typo
|
|
133
133
|
|
|
134
|
-
# 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/#
|
|
134
|
+
# 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/#configure-word-size-threshold-for-typos).
|
|
135
135
|
attr_accessor :min_word_sizefor2_typos
|
|
136
136
|
|
|
137
137
|
attr_accessor :typo_tolerance
|
|
138
138
|
|
|
139
|
-
# 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.
|
|
139
|
+
# 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.
|
|
140
140
|
attr_accessor :allow_typos_on_numeric_tokens
|
|
141
141
|
|
|
142
|
-
# 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.
|
|
142
|
+
# 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.
|
|
143
143
|
attr_accessor :disable_typo_tolerance_on_attributes
|
|
144
144
|
|
|
145
145
|
attr_accessor :ignore_plurals
|
|
@@ -149,7 +149,7 @@ module Algolia
|
|
|
149
149
|
# 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, place the CJK language **first**. **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).
|
|
150
150
|
attr_accessor :query_languages
|
|
151
151
|
|
|
152
|
-
# 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/#
|
|
152
|
+
# 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/#split-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).
|
|
153
153
|
attr_accessor :decompound_query
|
|
154
154
|
|
|
155
155
|
# Whether to enable rules.
|
|
@@ -166,7 +166,7 @@ module Algolia
|
|
|
166
166
|
|
|
167
167
|
attr_accessor :semantic_search
|
|
168
168
|
|
|
169
|
-
# Whether to support phrase matching and excluding words from search queries Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
|
|
169
|
+
# Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
|
|
170
170
|
attr_accessor :advanced_syntax
|
|
171
171
|
|
|
172
172
|
attr_accessor :optional_words
|
|
@@ -176,35 +176,37 @@ module Algolia
|
|
|
176
176
|
|
|
177
177
|
attr_accessor :exact_on_single_word_query
|
|
178
178
|
|
|
179
|
-
# 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.
|
|
179
|
+
# 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.
|
|
180
180
|
attr_accessor :alternatives_as_exact
|
|
181
181
|
|
|
182
|
-
# 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.
|
|
182
|
+
# 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.
|
|
183
183
|
attr_accessor :advanced_syntax_features
|
|
184
184
|
|
|
185
185
|
attr_accessor :distinct
|
|
186
186
|
|
|
187
|
-
# 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.
|
|
187
|
+
# 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.
|
|
188
188
|
attr_accessor :replace_synonyms_in_highlight
|
|
189
189
|
|
|
190
|
-
# 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.
|
|
190
|
+
# 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.
|
|
191
191
|
attr_accessor :min_proximity
|
|
192
192
|
|
|
193
|
-
# Properties to include in the API response of search and browse requests By default, all response properties are included. To reduce the response size, you can select which 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.
|
|
193
|
+
# Properties to include in the API response of search and browse requests. By default, all response properties are included. To reduce the response size, you can select which 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.
|
|
194
194
|
attr_accessor :response_fields
|
|
195
195
|
|
|
196
196
|
# Maximum number of facet values to return for each facet.
|
|
197
197
|
attr_accessor :max_values_per_facet
|
|
198
198
|
|
|
199
|
-
# 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).
|
|
199
|
+
# 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).
|
|
200
200
|
attr_accessor :sort_facet_values_by
|
|
201
201
|
|
|
202
|
-
# 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.
|
|
202
|
+
# 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. Prefer `attributeCriteriaComputedBy`, which expresses the same two behaviors and adds the `sum` strategy. If you set both, `attributeCriteriaComputedBy` takes precedence.
|
|
203
203
|
attr_accessor :attribute_criteria_computed_by_min_proximity
|
|
204
204
|
|
|
205
|
+
attr_accessor :attribute_criteria_computed_by
|
|
206
|
+
|
|
205
207
|
attr_accessor :rendering_content
|
|
206
208
|
|
|
207
|
-
# 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.
|
|
209
|
+
# 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.
|
|
208
210
|
attr_accessor :enable_re_ranking
|
|
209
211
|
|
|
210
212
|
attr_accessor :re_ranking_apply_filter
|
|
@@ -282,6 +284,7 @@ module Algolia
|
|
|
282
284
|
:max_values_per_facet => :maxValuesPerFacet,
|
|
283
285
|
:sort_facet_values_by => :sortFacetValuesBy,
|
|
284
286
|
:attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity,
|
|
287
|
+
:attribute_criteria_computed_by => :attributeCriteriaComputedBy,
|
|
285
288
|
:rendering_content => :renderingContent,
|
|
286
289
|
:enable_re_ranking => :enableReRanking,
|
|
287
290
|
:re_ranking_apply_filter => :reRankingApplyFilter
|
|
@@ -361,6 +364,7 @@ module Algolia
|
|
|
361
364
|
:max_values_per_facet => :"Integer",
|
|
362
365
|
:sort_facet_values_by => :"String",
|
|
363
366
|
:attribute_criteria_computed_by_min_proximity => :"Boolean",
|
|
367
|
+
:attribute_criteria_computed_by => :"AttributeCriteriaComputedBy",
|
|
364
368
|
:rendering_content => :"RenderingContent",
|
|
365
369
|
:enable_re_ranking => :"Boolean",
|
|
366
370
|
:re_ranking_apply_filter => :"ReRankingApplyFilter"
|
|
@@ -721,6 +725,10 @@ module Algolia
|
|
|
721
725
|
self.attribute_criteria_computed_by_min_proximity = attributes[:attribute_criteria_computed_by_min_proximity]
|
|
722
726
|
end
|
|
723
727
|
|
|
728
|
+
if attributes.key?(:attribute_criteria_computed_by)
|
|
729
|
+
self.attribute_criteria_computed_by = attributes[:attribute_criteria_computed_by]
|
|
730
|
+
end
|
|
731
|
+
|
|
724
732
|
if attributes.key?(:rendering_content)
|
|
725
733
|
self.rendering_content = attributes[:rendering_content]
|
|
726
734
|
end
|
|
@@ -809,6 +817,7 @@ module Algolia
|
|
|
809
817
|
max_values_per_facet == other.max_values_per_facet &&
|
|
810
818
|
sort_facet_values_by == other.sort_facet_values_by &&
|
|
811
819
|
attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity &&
|
|
820
|
+
attribute_criteria_computed_by == other.attribute_criteria_computed_by &&
|
|
812
821
|
rendering_content == other.rendering_content &&
|
|
813
822
|
enable_re_ranking == other.enable_re_ranking &&
|
|
814
823
|
re_ranking_apply_filter == other.re_ranking_apply_filter
|
|
@@ -894,6 +903,7 @@ module Algolia
|
|
|
894
903
|
max_values_per_facet,
|
|
895
904
|
sort_facet_values_by,
|
|
896
905
|
attribute_criteria_computed_by_min_proximity,
|
|
906
|
+
attribute_criteria_computed_by,
|
|
897
907
|
rendering_content,
|
|
898
908
|
enable_re_ranking,
|
|
899
909
|
re_ranking_apply_filter
|
|
@@ -16,7 +16,7 @@ module Algolia
|
|
|
16
16
|
# Timestamp when the secured API key expires, measured in seconds since the Unix epoch.
|
|
17
17
|
attr_accessor :valid_until
|
|
18
18
|
|
|
19
|
-
# Index names or patterns that this API key can access. By default, an API key can access all indices in the same application. You can use leading and trailing wildcard characters (`*`): - `dev_*` matches all indices starting with \"dev_\" - `*_dev` matches all indices ending with \"_dev\" - `*_products_*` matches all indices containing \"_products_\".
|
|
19
|
+
# Index names or patterns that this API key can access. By default, an API key can access all indices in the same application. You can use leading and trailing wildcard characters (`*`): - `dev_*` matches all indices starting with \"dev_\". - `*_dev` matches all indices ending with \"_dev\". - `*_products_*` matches all indices containing \"_products_\".
|
|
20
20
|
attr_accessor :restrict_indices
|
|
21
21
|
|
|
22
22
|
# IP network that are allowed to use this key. You can only add a single source, but you can provide a range of IP addresses. Use this to protect against API key leaking and reuse.
|
|
@@ -35,7 +35,7 @@ module Algolia
|
|
|
35
35
|
# Languages for language-specific processing steps, such as word detection and dictionary settings. **Always specify an indexing 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).
|
|
36
36
|
attr_accessor :index_languages
|
|
37
37
|
|
|
38
|
-
# Searchable attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#
|
|
38
|
+
# Searchable attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjust-prefix-search). Attribute names are case-sensitive.
|
|
39
39
|
attr_accessor :disable_prefix_on_attributes
|
|
40
40
|
|
|
41
41
|
# Whether arrays with exclusively non-negative integers should be compressed for better performance. If true, the compressed arrays may be reordered.
|
|
@@ -68,16 +68,16 @@ module Algolia
|
|
|
68
68
|
# 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.
|
|
69
69
|
attr_accessor :custom_ranking
|
|
70
70
|
|
|
71
|
-
# 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.
|
|
71
|
+
# 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.
|
|
72
72
|
attr_accessor :attributes_to_retrieve
|
|
73
73
|
|
|
74
74
|
# 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, test your changes in the dashboard, and by [A/B testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing).
|
|
75
75
|
attr_accessor :ranking
|
|
76
76
|
|
|
77
|
-
# 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/#
|
|
77
|
+
# 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/#standard-and-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
|
|
78
78
|
attr_accessor :relevancy_strictness
|
|
79
79
|
|
|
80
|
-
# 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).
|
|
80
|
+
# 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).
|
|
81
81
|
attr_accessor :attributes_to_highlight
|
|
82
82
|
|
|
83
83
|
# 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.
|
|
@@ -98,18 +98,18 @@ module Algolia
|
|
|
98
98
|
# Number of hits per page.
|
|
99
99
|
attr_accessor :hits_per_page
|
|
100
100
|
|
|
101
|
-
# 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/#
|
|
101
|
+
# 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/#configure-word-size-threshold-for-typos).
|
|
102
102
|
attr_accessor :min_word_sizefor1_typo
|
|
103
103
|
|
|
104
|
-
# 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/#
|
|
104
|
+
# 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/#configure-word-size-threshold-for-typos).
|
|
105
105
|
attr_accessor :min_word_sizefor2_typos
|
|
106
106
|
|
|
107
107
|
attr_accessor :typo_tolerance
|
|
108
108
|
|
|
109
|
-
# 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.
|
|
109
|
+
# 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.
|
|
110
110
|
attr_accessor :allow_typos_on_numeric_tokens
|
|
111
111
|
|
|
112
|
-
# 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.
|
|
112
|
+
# 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.
|
|
113
113
|
attr_accessor :disable_typo_tolerance_on_attributes
|
|
114
114
|
|
|
115
115
|
attr_accessor :ignore_plurals
|
|
@@ -119,7 +119,7 @@ module Algolia
|
|
|
119
119
|
# 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, place the CJK language **first**. **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).
|
|
120
120
|
attr_accessor :query_languages
|
|
121
121
|
|
|
122
|
-
# 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/#
|
|
122
|
+
# 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/#split-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).
|
|
123
123
|
attr_accessor :decompound_query
|
|
124
124
|
|
|
125
125
|
# Whether to enable rules.
|
|
@@ -136,7 +136,7 @@ module Algolia
|
|
|
136
136
|
|
|
137
137
|
attr_accessor :semantic_search
|
|
138
138
|
|
|
139
|
-
# Whether to support phrase matching and excluding words from search queries Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
|
|
139
|
+
# Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
|
|
140
140
|
attr_accessor :advanced_syntax
|
|
141
141
|
|
|
142
142
|
attr_accessor :optional_words
|
|
@@ -146,35 +146,37 @@ module Algolia
|
|
|
146
146
|
|
|
147
147
|
attr_accessor :exact_on_single_word_query
|
|
148
148
|
|
|
149
|
-
# 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.
|
|
149
|
+
# 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.
|
|
150
150
|
attr_accessor :alternatives_as_exact
|
|
151
151
|
|
|
152
|
-
# 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.
|
|
152
|
+
# 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.
|
|
153
153
|
attr_accessor :advanced_syntax_features
|
|
154
154
|
|
|
155
155
|
attr_accessor :distinct
|
|
156
156
|
|
|
157
|
-
# 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.
|
|
157
|
+
# 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.
|
|
158
158
|
attr_accessor :replace_synonyms_in_highlight
|
|
159
159
|
|
|
160
|
-
# 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.
|
|
160
|
+
# 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.
|
|
161
161
|
attr_accessor :min_proximity
|
|
162
162
|
|
|
163
|
-
# 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.
|
|
163
|
+
# 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.
|
|
164
164
|
attr_accessor :response_fields
|
|
165
165
|
|
|
166
166
|
# Maximum number of facet values to return for each facet.
|
|
167
167
|
attr_accessor :max_values_per_facet
|
|
168
168
|
|
|
169
|
-
# 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).
|
|
169
|
+
# 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).
|
|
170
170
|
attr_accessor :sort_facet_values_by
|
|
171
171
|
|
|
172
|
-
# 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.
|
|
172
|
+
# 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. Prefer `attributeCriteriaComputedBy`, which expresses the same two behaviors and adds the `sum` strategy. If you set both, `attributeCriteriaComputedBy` takes precedence.
|
|
173
173
|
attr_accessor :attribute_criteria_computed_by_min_proximity
|
|
174
174
|
|
|
175
|
+
attr_accessor :attribute_criteria_computed_by
|
|
176
|
+
|
|
175
177
|
attr_accessor :rendering_content
|
|
176
178
|
|
|
177
|
-
# 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.
|
|
179
|
+
# 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.
|
|
178
180
|
attr_accessor :enable_re_ranking
|
|
179
181
|
|
|
180
182
|
attr_accessor :re_ranking_apply_filter
|
|
@@ -243,6 +245,7 @@ module Algolia
|
|
|
243
245
|
:max_values_per_facet => :maxValuesPerFacet,
|
|
244
246
|
:sort_facet_values_by => :sortFacetValuesBy,
|
|
245
247
|
:attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity,
|
|
248
|
+
:attribute_criteria_computed_by => :attributeCriteriaComputedBy,
|
|
246
249
|
:rendering_content => :renderingContent,
|
|
247
250
|
:enable_re_ranking => :enableReRanking,
|
|
248
251
|
:re_ranking_apply_filter => :reRankingApplyFilter,
|
|
@@ -311,6 +314,7 @@ module Algolia
|
|
|
311
314
|
:max_values_per_facet => :"Integer",
|
|
312
315
|
:sort_facet_values_by => :"String",
|
|
313
316
|
:attribute_criteria_computed_by_min_proximity => :"Boolean",
|
|
317
|
+
:attribute_criteria_computed_by => :"AttributeCriteriaComputedBy",
|
|
314
318
|
:rendering_content => :"RenderingContent",
|
|
315
319
|
:enable_re_ranking => :"Boolean",
|
|
316
320
|
:re_ranking_apply_filter => :"ReRankingApplyFilter",
|
|
@@ -636,6 +640,10 @@ module Algolia
|
|
|
636
640
|
self.attribute_criteria_computed_by_min_proximity = attributes[:attribute_criteria_computed_by_min_proximity]
|
|
637
641
|
end
|
|
638
642
|
|
|
643
|
+
if attributes.key?(:attribute_criteria_computed_by)
|
|
644
|
+
self.attribute_criteria_computed_by = attributes[:attribute_criteria_computed_by]
|
|
645
|
+
end
|
|
646
|
+
|
|
639
647
|
if attributes.key?(:rendering_content)
|
|
640
648
|
self.rendering_content = attributes[:rendering_content]
|
|
641
649
|
end
|
|
@@ -716,6 +724,7 @@ module Algolia
|
|
|
716
724
|
max_values_per_facet == other.max_values_per_facet &&
|
|
717
725
|
sort_facet_values_by == other.sort_facet_values_by &&
|
|
718
726
|
attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity &&
|
|
727
|
+
attribute_criteria_computed_by == other.attribute_criteria_computed_by &&
|
|
719
728
|
rendering_content == other.rendering_content &&
|
|
720
729
|
enable_re_ranking == other.enable_re_ranking &&
|
|
721
730
|
re_ranking_apply_filter == other.re_ranking_apply_filter &&
|
|
@@ -790,6 +799,7 @@ module Algolia
|
|
|
790
799
|
max_values_per_facet,
|
|
791
800
|
sort_facet_values_by,
|
|
792
801
|
attribute_criteria_computed_by_min_proximity,
|
|
802
|
+
attribute_criteria_computed_by,
|
|
793
803
|
rendering_content,
|
|
794
804
|
enable_re_ranking,
|
|
795
805
|
re_ranking_apply_filter,
|
|
@@ -12,17 +12,21 @@ module Algolia
|
|
|
12
12
|
# Banners defined in the Merchandising Studio for a given search.
|
|
13
13
|
attr_accessor :banners
|
|
14
14
|
|
|
15
|
+
attr_accessor :result_card
|
|
16
|
+
|
|
15
17
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
16
18
|
def self.attribute_map
|
|
17
19
|
{
|
|
18
|
-
:banners => :banners
|
|
20
|
+
:banners => :banners,
|
|
21
|
+
:result_card => :resultCard
|
|
19
22
|
}
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
# Attribute type mapping.
|
|
23
26
|
def self.types_mapping
|
|
24
27
|
{
|
|
25
|
-
:banners => :"Array<Banner>"
|
|
28
|
+
:banners => :"Array<Banner>",
|
|
29
|
+
:result_card => :"ResultCard"
|
|
26
30
|
}
|
|
27
31
|
end
|
|
28
32
|
|
|
@@ -58,6 +62,10 @@ module Algolia
|
|
|
58
62
|
self.banners = value
|
|
59
63
|
end
|
|
60
64
|
end
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:result_card)
|
|
67
|
+
self.result_card = attributes[:result_card]
|
|
68
|
+
end
|
|
61
69
|
end
|
|
62
70
|
|
|
63
71
|
# Checks equality by comparing each attribute.
|
|
@@ -65,7 +73,8 @@ module Algolia
|
|
|
65
73
|
def ==(other)
|
|
66
74
|
return true if self.equal?(other)
|
|
67
75
|
self.class == other.class &&
|
|
68
|
-
banners == other.banners
|
|
76
|
+
banners == other.banners &&
|
|
77
|
+
result_card == other.result_card
|
|
69
78
|
end
|
|
70
79
|
|
|
71
80
|
# @see the `==` method
|
|
@@ -77,7 +86,7 @@ module Algolia
|
|
|
77
86
|
# Calculates hash code according to all attributes.
|
|
78
87
|
# @return [Integer] Hash code
|
|
79
88
|
def hash
|
|
80
|
-
[banners].hash
|
|
89
|
+
[banners, result_card].hash
|
|
81
90
|
end
|
|
82
91
|
|
|
83
92
|
# Builds the object from hash
|
|
@@ -30,8 +30,15 @@ module Algolia
|
|
|
30
30
|
@requester = requester
|
|
31
31
|
@request_id_support = request_id_support
|
|
32
32
|
@retry_strategy = RetryStrategy.new(config.hosts)
|
|
33
|
+
@sleeper = Kernel.method(:sleep)
|
|
33
34
|
end
|
|
34
35
|
|
|
36
|
+
# Callable waiting the given number of whole seconds before a 429 is retried,
|
|
37
|
+
# Kernel#sleep by default. Private on purpose: it is a test seam, not gem
|
|
38
|
+
# surface, and the tests reach it with send(:sleeper=, ...).
|
|
39
|
+
attr_writer :sleeper
|
|
40
|
+
private :sleeper=
|
|
41
|
+
|
|
35
42
|
# Whether the transport mints Request-ID headers. Resolved per request so a
|
|
36
43
|
# caller can flip config.request_id_enabled at any time, like every other
|
|
37
44
|
# Configuration setting; nil falls back to the per-client capability.
|
|
@@ -67,6 +74,9 @@ module Algolia
|
|
|
67
74
|
# non-empty one, surfaced on the exhaustion error for support tickets.
|
|
68
75
|
last_correlation_id = nil
|
|
69
76
|
|
|
77
|
+
# Budget of 429 waits for this request, shared across hosts.
|
|
78
|
+
rate_limit_retries_left = max_rate_limit_retries
|
|
79
|
+
|
|
70
80
|
@retry_strategy.get_tryable_hosts(call_type).each do |host|
|
|
71
81
|
opts[:header_params] ||= header_params
|
|
72
82
|
opts[:query_params] ||= query_params
|
|
@@ -79,16 +89,22 @@ module Algolia
|
|
|
79
89
|
# request_options.query_params.merge!(request_options.data) if method == :GET
|
|
80
90
|
|
|
81
91
|
request = build_request(method, path, body, request_options, request_id)
|
|
82
|
-
response =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
response = send_request(host, request)
|
|
93
|
+
|
|
94
|
+
# HTTP 429 is not a host failover: wait Retry-After (whole seconds, 1s when
|
|
95
|
+
# missing or invalid) and resend the same request to the same host. The retry
|
|
96
|
+
# strategy only sees the final response, so a waited-out 429 never marks the
|
|
97
|
+
# host down nor bumps its retry_count. The attempt is still recorded, with its
|
|
98
|
+
# Correlation-ID, so the exhaustion error keeps it visible.
|
|
99
|
+
while response.status == 429 && rate_limit_retries_left > 0
|
|
100
|
+
rate_limit_retries_left -= 1
|
|
101
|
+
correlation_id = correlation_id_from(response.headers)
|
|
102
|
+
last_correlation_id = correlation_id unless correlation_id.nil? || correlation_id.empty?
|
|
103
|
+
retry_errors << {host: host.url, error: response.error}
|
|
104
|
+
|
|
105
|
+
@sleeper.call(rate_limit_wait_seconds(response.headers))
|
|
106
|
+
response = send_request(host, request)
|
|
107
|
+
end
|
|
92
108
|
|
|
93
109
|
outcome = @retry_strategy.decide(
|
|
94
110
|
host,
|
|
@@ -128,6 +144,62 @@ module Algolia
|
|
|
128
144
|
|
|
129
145
|
private
|
|
130
146
|
|
|
147
|
+
# Sends an already built request to the given host.
|
|
148
|
+
#
|
|
149
|
+
# @param host [StatefulHost]
|
|
150
|
+
# @param request [Hash] the request built by build_request
|
|
151
|
+
#
|
|
152
|
+
# @return [Response]
|
|
153
|
+
#
|
|
154
|
+
def send_request(host, request)
|
|
155
|
+
@requester.send_request(
|
|
156
|
+
host,
|
|
157
|
+
request[:method],
|
|
158
|
+
request[:path],
|
|
159
|
+
request[:body],
|
|
160
|
+
request[:query_params],
|
|
161
|
+
request[:header_params],
|
|
162
|
+
request[:timeout],
|
|
163
|
+
request[:connect_timeout]
|
|
164
|
+
)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# How many 429s are waited out per request: nil falls back to the default, a
|
|
168
|
+
# negative value behaves like 0, and so does false, which a caller may pass to
|
|
169
|
+
# mean "no retries" (only nil means unset, as for request_id_enabled).
|
|
170
|
+
#
|
|
171
|
+
# @return [Integer]
|
|
172
|
+
#
|
|
173
|
+
def max_rate_limit_retries
|
|
174
|
+
retries = @config.max_rate_limit_retries
|
|
175
|
+
return Defaults::MAX_RATE_LIMIT_RETRIES if retries.nil?
|
|
176
|
+
|
|
177
|
+
[retries || 0, 0].max
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Retry-After as a wait in whole seconds. Only a positive whole number of ASCII
|
|
181
|
+
# digits is honoured (header key matched case-insensitively, value trimmed); a
|
|
182
|
+
# missing, empty, zero, negative, fractional, HTTP-date or junk value waits
|
|
183
|
+
# Defaults::RATE_LIMIT_WAIT. A value above what Kernel#sleep accepts saturates at
|
|
184
|
+
# Defaults::MAX_RATE_LIMIT_WAIT rather than being capped or falling back.
|
|
185
|
+
#
|
|
186
|
+
# @param headers [Hash, String]
|
|
187
|
+
#
|
|
188
|
+
# @return [Integer]
|
|
189
|
+
#
|
|
190
|
+
def rate_limit_wait_seconds(headers)
|
|
191
|
+
return Defaults::RATE_LIMIT_WAIT unless headers.respond_to?(:each_pair)
|
|
192
|
+
|
|
193
|
+
value = headers.find { |k, _| k.to_s.casecmp?("Retry-After") }&.last
|
|
194
|
+
raw = value.to_s.strip
|
|
195
|
+
return Defaults::RATE_LIMIT_WAIT unless raw.match?(/\A[0-9]+\z/)
|
|
196
|
+
|
|
197
|
+
seconds = Integer(raw, 10)
|
|
198
|
+
return Defaults::RATE_LIMIT_WAIT if seconds <= 0
|
|
199
|
+
|
|
200
|
+
[seconds, Defaults::MAX_RATE_LIMIT_WAIT].min
|
|
201
|
+
end
|
|
202
|
+
|
|
131
203
|
# Returns a fresh Request-ID, or nil when the feature is off for this client
|
|
132
204
|
# or the caller already supplied one through the request options, the config
|
|
133
205
|
# default headers, or the x-algolia-request-id query parameter. Caller-supplied
|
data/lib/algolia/version.rb
CHANGED