From c22c7c7dd5b89d2f44a3031b6dad41fed3e84960 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Fri, 15 Nov 2024 14:47:22 +0000 Subject: [PATCH] fix(specs): make the searchParams compatible with v4 [skip-bc] (generated) https://github.com/algolia/api-clients-automation/pull/4108 Co-authored-by: algolia-bot Co-authored-by: Pierre Millot --- .../models/recommend/fallback_params.rb | 41 +++---- .../models/recommend/inside_bounding_box.rb | 108 ++++++++++++++++++ .../models/recommend/optional_words.rb | 108 ++++++++++++++++++ .../recommend/recommend_search_params.rb | 41 +++---- .../models/search/browse_params_object.rb | 30 ++--- .../models/search/consequence_params.rb | 30 ++--- lib/algolia/models/search/delete_by_params.rb | 11 +- lib/algolia/models/search/index_settings.rb | 33 +++--- .../models/search/inside_bounding_box.rb | 108 ++++++++++++++++++ lib/algolia/models/search/optional_words.rb | 108 ++++++++++++++++++ .../models/search/search_for_facets.rb | 41 +++---- lib/algolia/models/search/search_for_hits.rb | 30 ++--- .../models/search/search_params_object.rb | 30 ++--- .../models/search/settings_response.rb | 33 +++--- 14 files changed, 558 insertions(+), 194 deletions(-) create mode 100644 lib/algolia/models/recommend/inside_bounding_box.rb create mode 100644 lib/algolia/models/recommend/optional_words.rb create mode 100644 lib/algolia/models/search/inside_bounding_box.rb create mode 100644 lib/algolia/models/search/optional_words.rb diff --git a/lib/algolia/models/recommend/fallback_params.rb b/lib/algolia/models/recommend/fallback_params.rb index fbf91b76..9aa83006 100644 --- a/lib/algolia/models/recommend/fallback_params.rb +++ b/lib/algolia/models/recommend/fallback_params.rb @@ -45,7 +45,6 @@ class FallbackParams # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. attr_accessor :minimum_around_radius - # Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). attr_accessor :inside_bounding_box # 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`. @@ -138,6 +137,9 @@ class FallbackParams # Attribute that should be used to establish groups of results. Attribute names are case-sensitive. All records with the same value for this attribute are considered a group. You can combine `attributeForDistinct` with the `distinct` search parameter to control how many items per group are included in the search results. If you want to use the same attribute also for faceting, use the `afterDistinct` modifier of the `attributesForFaceting` setting. This applies faceting _after_ deduplication, which will result in accurate facet counts. attr_accessor :attribute_for_distinct + # 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). + attr_accessor :max_facet_hits + # 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. attr_accessor :attributes_to_retrieve @@ -202,7 +204,6 @@ class FallbackParams # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. attr_accessor :advanced_syntax - # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). attr_accessor :optional_words # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. @@ -227,9 +228,6 @@ class FallbackParams # 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. attr_accessor :response_fields - # 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). - attr_accessor :max_facet_hits - # Maximum number of facet values to return for each facet. attr_accessor :max_values_per_facet @@ -295,6 +293,7 @@ def self.attribute_map :user_data => :userData, :custom_normalization => :customNormalization, :attribute_for_distinct => :attributeForDistinct, + :max_facet_hits => :maxFacetHits, :attributes_to_retrieve => :attributesToRetrieve, :ranking => :ranking, :relevancy_strictness => :relevancyStrictness, @@ -327,7 +326,6 @@ def self.attribute_map :replace_synonyms_in_highlight => :replaceSynonymsInHighlight, :min_proximity => :minProximity, :response_fields => :responseFields, - :max_facet_hits => :maxFacetHits, :max_values_per_facet => :maxValuesPerFacet, :sort_facet_values_by => :sortFacetValuesBy, :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity, @@ -360,7 +358,7 @@ def self.types_mapping :around_radius => :"AroundRadius", :around_precision => :"AroundPrecision", :minimum_around_radius => :"Integer", - :inside_bounding_box => :"Array>", + :inside_bounding_box => :"InsideBoundingBox", :inside_polygon => :"Array>", :natural_languages => :"Array", :rule_contexts => :"Array", @@ -391,6 +389,7 @@ def self.types_mapping :user_data => :"Object", :custom_normalization => :"Hash>", :attribute_for_distinct => :"String", + :max_facet_hits => :"Integer", :attributes_to_retrieve => :"Array", :ranking => :"Array", :relevancy_strictness => :"Integer", @@ -414,7 +413,7 @@ def self.types_mapping :query_type => :"QueryType", :remove_words_if_no_results => :"RemoveWordsIfNoResults", :advanced_syntax => :"Boolean", - :optional_words => :"Array", + :optional_words => :"OptionalWords", :disable_exact_on_attributes => :"Array", :exact_on_single_word_query => :"ExactOnSingleWordQuery", :alternatives_as_exact => :"Array", @@ -423,7 +422,6 @@ def self.types_mapping :replace_synonyms_in_highlight => :"Boolean", :min_proximity => :"Integer", :response_fields => :"Array", - :max_facet_hits => :"Integer", :max_values_per_facet => :"Integer", :sort_facet_values_by => :"String", :attribute_criteria_computed_by_min_proximity => :"Boolean", @@ -436,7 +434,10 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :inside_bounding_box, + :optional_words + ] ) end @@ -535,9 +536,7 @@ def initialize(attributes = {}) end if attributes.key?(:inside_bounding_box) - if (value = attributes[:inside_bounding_box]).is_a?(Array) - self.inside_bounding_box = value - end + self.inside_bounding_box = attributes[:inside_bounding_box] end if attributes.key?(:inside_polygon) @@ -690,6 +689,10 @@ def initialize(attributes = {}) self.attribute_for_distinct = attributes[:attribute_for_distinct] end + if attributes.key?(:max_facet_hits) + self.max_facet_hits = attributes[:max_facet_hits] + end + if attributes.key?(:attributes_to_retrieve) if (value = attributes[:attributes_to_retrieve]).is_a?(Array) self.attributes_to_retrieve = value @@ -795,9 +798,7 @@ def initialize(attributes = {}) end if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end + self.optional_words = attributes[:optional_words] end if attributes.key?(:disable_exact_on_attributes) @@ -840,10 +841,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:max_facet_hits) - self.max_facet_hits = attributes[:max_facet_hits] - end - if attributes.key?(:max_values_per_facet) self.max_values_per_facet = attributes[:max_values_per_facet] end @@ -920,6 +917,7 @@ def ==(other) user_data == other.user_data && custom_normalization == other.custom_normalization && attribute_for_distinct == other.attribute_for_distinct && + max_facet_hits == other.max_facet_hits && attributes_to_retrieve == other.attributes_to_retrieve && ranking == other.ranking && relevancy_strictness == other.relevancy_strictness && @@ -952,7 +950,6 @@ def ==(other) replace_synonyms_in_highlight == other.replace_synonyms_in_highlight && min_proximity == other.min_proximity && response_fields == other.response_fields && - max_facet_hits == other.max_facet_hits && max_values_per_facet == other.max_values_per_facet && sort_facet_values_by == other.sort_facet_values_by && attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity && @@ -1017,6 +1014,7 @@ def hash user_data, custom_normalization, attribute_for_distinct, + max_facet_hits, attributes_to_retrieve, ranking, relevancy_strictness, @@ -1049,7 +1047,6 @@ def hash replace_synonyms_in_highlight, min_proximity, response_fields, - max_facet_hits, max_values_per_facet, sort_facet_values_by, attribute_criteria_computed_by_min_proximity, diff --git a/lib/algolia/models/recommend/inside_bounding_box.rb b/lib/algolia/models/recommend/inside_bounding_box.rb new file mode 100644 index 00000000..4f292426 --- /dev/null +++ b/lib/algolia/models/recommend/inside_bounding_box.rb @@ -0,0 +1,108 @@ +# 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. + +require "date" +require "time" + +module Algolia + module Recommend + module InsideBoundingBox + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :"Array>", + :"String" + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + # "nullable: true" + next if klass == :AnyType + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + # rescue all errors so we keep iterating even if the current item lookup raises + rescue + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when "Boolean" + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when "Float" + return data if data.instance_of?(Float) + when "Integer" + return data if data.instance_of?(Integer) + when "Time" + return Time.parse(data) + when "Date" + return Date.parse(data) + when "String" + return data if data.instance_of?(String) + # "type: object" + when "Object" + return data if data.instance_of?(Hash) + # "type: array" + when /\AArray<(?.+)>\z/ + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + # "type: object" with "additionalProperties: { ... }" + when /\AHash.+)>\z/ + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + # model + else + const = Algolia::Recommend.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) + # nested oneOf model + model = const.build(data) + elsif const.respond_to?(:acceptable_attributes) + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + else + # maybe it's an enum + model = const.build_from_hash(data) + end + + return model if model + end + end + + # if no match by now, raise + raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + + end +end diff --git a/lib/algolia/models/recommend/optional_words.rb b/lib/algolia/models/recommend/optional_words.rb new file mode 100644 index 00000000..f1af98c6 --- /dev/null +++ b/lib/algolia/models/recommend/optional_words.rb @@ -0,0 +1,108 @@ +# 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. + +require "date" +require "time" + +module Algolia + module Recommend + module OptionalWords + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :"Array", + :"String" + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + # "nullable: true" + next if klass == :AnyType + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + # rescue all errors so we keep iterating even if the current item lookup raises + rescue + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when "Boolean" + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when "Float" + return data if data.instance_of?(Float) + when "Integer" + return data if data.instance_of?(Integer) + when "Time" + return Time.parse(data) + when "Date" + return Date.parse(data) + when "String" + return data if data.instance_of?(String) + # "type: object" + when "Object" + return data if data.instance_of?(Hash) + # "type: array" + when /\AArray<(?.+)>\z/ + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + # "type: object" with "additionalProperties: { ... }" + when /\AHash.+)>\z/ + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + # model + else + const = Algolia::Recommend.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) + # nested oneOf model + model = const.build(data) + elsif const.respond_to?(:acceptable_attributes) + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + else + # maybe it's an enum + model = const.build_from_hash(data) + end + + return model if model + end + end + + # if no match by now, raise + raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + + end +end diff --git a/lib/algolia/models/recommend/recommend_search_params.rb b/lib/algolia/models/recommend/recommend_search_params.rb index 4253c8e8..d7e6a023 100644 --- a/lib/algolia/models/recommend/recommend_search_params.rb +++ b/lib/algolia/models/recommend/recommend_search_params.rb @@ -46,7 +46,6 @@ class RecommendSearchParams # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. attr_accessor :minimum_around_radius - # Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). attr_accessor :inside_bounding_box # 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`. @@ -139,6 +138,9 @@ class RecommendSearchParams # Attribute that should be used to establish groups of results. Attribute names are case-sensitive. All records with the same value for this attribute are considered a group. You can combine `attributeForDistinct` with the `distinct` search parameter to control how many items per group are included in the search results. If you want to use the same attribute also for faceting, use the `afterDistinct` modifier of the `attributesForFaceting` setting. This applies faceting _after_ deduplication, which will result in accurate facet counts. attr_accessor :attribute_for_distinct + # 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). + attr_accessor :max_facet_hits + # 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. attr_accessor :attributes_to_retrieve @@ -203,7 +205,6 @@ class RecommendSearchParams # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. attr_accessor :advanced_syntax - # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). attr_accessor :optional_words # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. @@ -228,9 +229,6 @@ class RecommendSearchParams # 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. attr_accessor :response_fields - # 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). - attr_accessor :max_facet_hits - # Maximum number of facet values to return for each facet. attr_accessor :max_values_per_facet @@ -296,6 +294,7 @@ def self.attribute_map :user_data => :userData, :custom_normalization => :customNormalization, :attribute_for_distinct => :attributeForDistinct, + :max_facet_hits => :maxFacetHits, :attributes_to_retrieve => :attributesToRetrieve, :ranking => :ranking, :relevancy_strictness => :relevancyStrictness, @@ -328,7 +327,6 @@ def self.attribute_map :replace_synonyms_in_highlight => :replaceSynonymsInHighlight, :min_proximity => :minProximity, :response_fields => :responseFields, - :max_facet_hits => :maxFacetHits, :max_values_per_facet => :maxValuesPerFacet, :sort_facet_values_by => :sortFacetValuesBy, :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity, @@ -361,7 +359,7 @@ def self.types_mapping :around_radius => :"AroundRadius", :around_precision => :"AroundPrecision", :minimum_around_radius => :"Integer", - :inside_bounding_box => :"Array>", + :inside_bounding_box => :"InsideBoundingBox", :inside_polygon => :"Array>", :natural_languages => :"Array", :rule_contexts => :"Array", @@ -392,6 +390,7 @@ def self.types_mapping :user_data => :"Object", :custom_normalization => :"Hash>", :attribute_for_distinct => :"String", + :max_facet_hits => :"Integer", :attributes_to_retrieve => :"Array", :ranking => :"Array", :relevancy_strictness => :"Integer", @@ -415,7 +414,7 @@ def self.types_mapping :query_type => :"QueryType", :remove_words_if_no_results => :"RemoveWordsIfNoResults", :advanced_syntax => :"Boolean", - :optional_words => :"Array", + :optional_words => :"OptionalWords", :disable_exact_on_attributes => :"Array", :exact_on_single_word_query => :"ExactOnSingleWordQuery", :alternatives_as_exact => :"Array", @@ -424,7 +423,6 @@ def self.types_mapping :replace_synonyms_in_highlight => :"Boolean", :min_proximity => :"Integer", :response_fields => :"Array", - :max_facet_hits => :"Integer", :max_values_per_facet => :"Integer", :sort_facet_values_by => :"String", :attribute_criteria_computed_by_min_proximity => :"Boolean", @@ -437,7 +435,10 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :inside_bounding_box, + :optional_words + ] ) end @@ -538,9 +539,7 @@ def initialize(attributes = {}) end if attributes.key?(:inside_bounding_box) - if (value = attributes[:inside_bounding_box]).is_a?(Array) - self.inside_bounding_box = value - end + self.inside_bounding_box = attributes[:inside_bounding_box] end if attributes.key?(:inside_polygon) @@ -693,6 +692,10 @@ def initialize(attributes = {}) self.attribute_for_distinct = attributes[:attribute_for_distinct] end + if attributes.key?(:max_facet_hits) + self.max_facet_hits = attributes[:max_facet_hits] + end + if attributes.key?(:attributes_to_retrieve) if (value = attributes[:attributes_to_retrieve]).is_a?(Array) self.attributes_to_retrieve = value @@ -798,9 +801,7 @@ def initialize(attributes = {}) end if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end + self.optional_words = attributes[:optional_words] end if attributes.key?(:disable_exact_on_attributes) @@ -843,10 +844,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:max_facet_hits) - self.max_facet_hits = attributes[:max_facet_hits] - end - if attributes.key?(:max_values_per_facet) self.max_values_per_facet = attributes[:max_values_per_facet] end @@ -923,6 +920,7 @@ def ==(other) user_data == other.user_data && custom_normalization == other.custom_normalization && attribute_for_distinct == other.attribute_for_distinct && + max_facet_hits == other.max_facet_hits && attributes_to_retrieve == other.attributes_to_retrieve && ranking == other.ranking && relevancy_strictness == other.relevancy_strictness && @@ -955,7 +953,6 @@ def ==(other) replace_synonyms_in_highlight == other.replace_synonyms_in_highlight && min_proximity == other.min_proximity && response_fields == other.response_fields && - max_facet_hits == other.max_facet_hits && max_values_per_facet == other.max_values_per_facet && sort_facet_values_by == other.sort_facet_values_by && attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity && @@ -1020,6 +1017,7 @@ def hash user_data, custom_normalization, attribute_for_distinct, + max_facet_hits, attributes_to_retrieve, ranking, relevancy_strictness, @@ -1052,7 +1050,6 @@ def hash replace_synonyms_in_highlight, min_proximity, response_fields, - max_facet_hits, max_values_per_facet, sort_facet_values_by, attribute_criteria_computed_by_min_proximity, diff --git a/lib/algolia/models/search/browse_params_object.rb b/lib/algolia/models/search/browse_params_object.rb index 85c331bd..67dab56a 100644 --- a/lib/algolia/models/search/browse_params_object.rb +++ b/lib/algolia/models/search/browse_params_object.rb @@ -57,7 +57,6 @@ class BrowseParamsObject # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. attr_accessor :minimum_around_radius - # Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). attr_accessor :inside_bounding_box # Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`. @@ -173,7 +172,6 @@ class BrowseParamsObject # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. attr_accessor :advanced_syntax - # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). attr_accessor :optional_words # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. @@ -198,9 +196,6 @@ class BrowseParamsObject # 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. attr_accessor :response_fields - # 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). - attr_accessor :max_facet_hits - # Maximum number of facet values to return for each facet. attr_accessor :max_values_per_facet @@ -292,7 +287,6 @@ def self.attribute_map :replace_synonyms_in_highlight => :replaceSynonymsInHighlight, :min_proximity => :minProximity, :response_fields => :responseFields, - :max_facet_hits => :maxFacetHits, :max_values_per_facet => :maxValuesPerFacet, :sort_facet_values_by => :sortFacetValuesBy, :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity, @@ -330,7 +324,7 @@ def self.types_mapping :around_radius => :"AroundRadius", :around_precision => :"AroundPrecision", :minimum_around_radius => :"Integer", - :inside_bounding_box => :"Array>", + :inside_bounding_box => :"InsideBoundingBox", :inside_polygon => :"Array>", :natural_languages => :"Array", :rule_contexts => :"Array", @@ -371,7 +365,7 @@ def self.types_mapping :mode => :"Mode", :semantic_search => :"SemanticSearch", :advanced_syntax => :"Boolean", - :optional_words => :"Array", + :optional_words => :"OptionalWords", :disable_exact_on_attributes => :"Array", :exact_on_single_word_query => :"ExactOnSingleWordQuery", :alternatives_as_exact => :"Array", @@ -380,7 +374,6 @@ def self.types_mapping :replace_synonyms_in_highlight => :"Boolean", :min_proximity => :"Integer", :response_fields => :"Array", - :max_facet_hits => :"Integer", :max_values_per_facet => :"Integer", :sort_facet_values_by => :"String", :attribute_criteria_computed_by_min_proximity => :"Boolean", @@ -394,7 +387,10 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :inside_bounding_box, + :optional_words + ] ) end @@ -510,9 +506,7 @@ def initialize(attributes = {}) end if attributes.key?(:inside_bounding_box) - if (value = attributes[:inside_bounding_box]).is_a?(Array) - self.inside_bounding_box = value - end + self.inside_bounding_box = attributes[:inside_bounding_box] end if attributes.key?(:inside_polygon) @@ -698,9 +692,7 @@ def initialize(attributes = {}) end if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end + self.optional_words = attributes[:optional_words] end if attributes.key?(:disable_exact_on_attributes) @@ -743,10 +735,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:max_facet_hits) - self.max_facet_hits = attributes[:max_facet_hits] - end - if attributes.key?(:max_values_per_facet) self.max_values_per_facet = attributes[:max_values_per_facet] end @@ -850,7 +838,6 @@ def ==(other) replace_synonyms_in_highlight == other.replace_synonyms_in_highlight && min_proximity == other.min_proximity && response_fields == other.response_fields && - max_facet_hits == other.max_facet_hits && max_values_per_facet == other.max_values_per_facet && sort_facet_values_by == other.sort_facet_values_by && attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity && @@ -939,7 +926,6 @@ def hash replace_synonyms_in_highlight, min_proximity, response_fields, - max_facet_hits, max_values_per_facet, sort_facet_values_by, attribute_criteria_computed_by_min_proximity, diff --git a/lib/algolia/models/search/consequence_params.rb b/lib/algolia/models/search/consequence_params.rb index 8bbdfbbb..e73916aa 100644 --- a/lib/algolia/models/search/consequence_params.rb +++ b/lib/algolia/models/search/consequence_params.rb @@ -54,7 +54,6 @@ class ConsequenceParams # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. attr_accessor :minimum_around_radius - # Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). attr_accessor :inside_bounding_box # Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`. @@ -170,7 +169,6 @@ class ConsequenceParams # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. attr_accessor :advanced_syntax - # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). attr_accessor :optional_words # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. @@ -195,9 +193,6 @@ class ConsequenceParams # 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. attr_accessor :response_fields - # 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). - attr_accessor :max_facet_hits - # Maximum number of facet values to return for each facet. attr_accessor :max_values_per_facet @@ -291,7 +286,6 @@ def self.attribute_map :replace_synonyms_in_highlight => :replaceSynonymsInHighlight, :min_proximity => :minProximity, :response_fields => :responseFields, - :max_facet_hits => :maxFacetHits, :max_values_per_facet => :maxValuesPerFacet, :sort_facet_values_by => :sortFacetValuesBy, :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity, @@ -330,7 +324,7 @@ def self.types_mapping :around_radius => :"AroundRadius", :around_precision => :"AroundPrecision", :minimum_around_radius => :"Integer", - :inside_bounding_box => :"Array>", + :inside_bounding_box => :"InsideBoundingBox", :inside_polygon => :"Array>", :natural_languages => :"Array", :rule_contexts => :"Array", @@ -371,7 +365,7 @@ def self.types_mapping :mode => :"Mode", :semantic_search => :"SemanticSearch", :advanced_syntax => :"Boolean", - :optional_words => :"Array", + :optional_words => :"OptionalWords", :disable_exact_on_attributes => :"Array", :exact_on_single_word_query => :"ExactOnSingleWordQuery", :alternatives_as_exact => :"Array", @@ -380,7 +374,6 @@ def self.types_mapping :replace_synonyms_in_highlight => :"Boolean", :min_proximity => :"Integer", :response_fields => :"Array", - :max_facet_hits => :"Integer", :max_values_per_facet => :"Integer", :sort_facet_values_by => :"String", :attribute_criteria_computed_by_min_proximity => :"Boolean", @@ -396,7 +389,10 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :inside_bounding_box, + :optional_words + ] ) end @@ -509,9 +505,7 @@ def initialize(attributes = {}) end if attributes.key?(:inside_bounding_box) - if (value = attributes[:inside_bounding_box]).is_a?(Array) - self.inside_bounding_box = value - end + self.inside_bounding_box = attributes[:inside_bounding_box] end if attributes.key?(:inside_polygon) @@ -697,9 +691,7 @@ def initialize(attributes = {}) end if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end + self.optional_words = attributes[:optional_words] end if attributes.key?(:disable_exact_on_attributes) @@ -742,10 +734,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:max_facet_hits) - self.max_facet_hits = attributes[:max_facet_hits] - end - if attributes.key?(:max_values_per_facet) self.max_values_per_facet = attributes[:max_values_per_facet] end @@ -856,7 +844,6 @@ def ==(other) replace_synonyms_in_highlight == other.replace_synonyms_in_highlight && min_proximity == other.min_proximity && response_fields == other.response_fields && - max_facet_hits == other.max_facet_hits && max_values_per_facet == other.max_values_per_facet && sort_facet_values_by == other.sort_facet_values_by && attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity && @@ -946,7 +933,6 @@ def hash replace_synonyms_in_highlight, min_proximity, response_fields, - max_facet_hits, max_values_per_facet, sort_facet_values_by, attribute_criteria_computed_by_min_proximity, diff --git a/lib/algolia/models/search/delete_by_params.rb b/lib/algolia/models/search/delete_by_params.rb index 876fa5b6..9aa30cde 100644 --- a/lib/algolia/models/search/delete_by_params.rb +++ b/lib/algolia/models/search/delete_by_params.rb @@ -20,7 +20,6 @@ class DeleteByParams attr_accessor :around_radius - # Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). attr_accessor :inside_bounding_box # Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`. @@ -54,7 +53,7 @@ def self.types_mapping :tag_filters => :"TagFilters", :around_lat_lng => :"String", :around_radius => :"AroundRadius", - :inside_bounding_box => :"Array>", + :inside_bounding_box => :"InsideBoundingBox", :inside_polygon => :"Array>" } end @@ -62,7 +61,9 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :inside_bounding_box + ] ) end @@ -114,9 +115,7 @@ def initialize(attributes = {}) end if attributes.key?(:inside_bounding_box) - if (value = attributes[:inside_bounding_box]).is_a?(Array) - self.inside_bounding_box = value - end + self.inside_bounding_box = attributes[:inside_bounding_box] end if attributes.key?(:inside_polygon) diff --git a/lib/algolia/models/search/index_settings.rb b/lib/algolia/models/search/index_settings.rb index 7600a571..58e91629 100644 --- a/lib/algolia/models/search/index_settings.rb +++ b/lib/algolia/models/search/index_settings.rb @@ -58,6 +58,9 @@ class IndexSettings # Attribute that should be used to establish groups of results. Attribute names are case-sensitive. All records with the same value for this attribute are considered a group. You can combine `attributeForDistinct` with the `distinct` search parameter to control how many items per group are included in the search results. If you want to use the same attribute also for faceting, use the `afterDistinct` modifier of the `attributesForFaceting` setting. This applies faceting _after_ deduplication, which will result in accurate facet counts. attr_accessor :attribute_for_distinct + # 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). + attr_accessor :max_facet_hits + # 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. attr_accessor :attributes_to_retrieve @@ -135,7 +138,6 @@ class IndexSettings # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. attr_accessor :advanced_syntax - # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). attr_accessor :optional_words # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. @@ -160,9 +162,6 @@ class IndexSettings # 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. attr_accessor :response_fields - # 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). - attr_accessor :max_facet_hits - # Maximum number of facet values to return for each facet. attr_accessor :max_values_per_facet @@ -199,6 +198,7 @@ def self.attribute_map :user_data => :userData, :custom_normalization => :customNormalization, :attribute_for_distinct => :attributeForDistinct, + :max_facet_hits => :maxFacetHits, :attributes_to_retrieve => :attributesToRetrieve, :ranking => :ranking, :custom_ranking => :customRanking, @@ -236,7 +236,6 @@ def self.attribute_map :replace_synonyms_in_highlight => :replaceSynonymsInHighlight, :min_proximity => :minProximity, :response_fields => :responseFields, - :max_facet_hits => :maxFacetHits, :max_values_per_facet => :maxValuesPerFacet, :sort_facet_values_by => :sortFacetValuesBy, :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity, @@ -271,6 +270,7 @@ def self.types_mapping :user_data => :"Object", :custom_normalization => :"Hash>", :attribute_for_distinct => :"String", + :max_facet_hits => :"Integer", :attributes_to_retrieve => :"Array", :ranking => :"Array", :custom_ranking => :"Array", @@ -299,7 +299,7 @@ def self.types_mapping :mode => :"Mode", :semantic_search => :"SemanticSearch", :advanced_syntax => :"Boolean", - :optional_words => :"Array", + :optional_words => :"OptionalWords", :disable_exact_on_attributes => :"Array", :exact_on_single_word_query => :"ExactOnSingleWordQuery", :alternatives_as_exact => :"Array", @@ -308,7 +308,6 @@ def self.types_mapping :replace_synonyms_in_highlight => :"Boolean", :min_proximity => :"Integer", :response_fields => :"Array", - :max_facet_hits => :"Integer", :max_values_per_facet => :"Integer", :sort_facet_values_by => :"String", :attribute_criteria_computed_by_min_proximity => :"Boolean", @@ -321,7 +320,9 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :optional_words + ] ) end @@ -446,6 +447,10 @@ def initialize(attributes = {}) self.attribute_for_distinct = attributes[:attribute_for_distinct] end + if attributes.key?(:max_facet_hits) + self.max_facet_hits = attributes[:max_facet_hits] + end + if attributes.key?(:attributes_to_retrieve) if (value = attributes[:attributes_to_retrieve]).is_a?(Array) self.attributes_to_retrieve = value @@ -573,9 +578,7 @@ def initialize(attributes = {}) end if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end + self.optional_words = attributes[:optional_words] end if attributes.key?(:disable_exact_on_attributes) @@ -618,10 +621,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:max_facet_hits) - self.max_facet_hits = attributes[:max_facet_hits] - end - if attributes.key?(:max_values_per_facet) self.max_values_per_facet = attributes[:max_values_per_facet] end @@ -669,6 +668,7 @@ def ==(other) user_data == other.user_data && custom_normalization == other.custom_normalization && attribute_for_distinct == other.attribute_for_distinct && + max_facet_hits == other.max_facet_hits && attributes_to_retrieve == other.attributes_to_retrieve && ranking == other.ranking && custom_ranking == other.custom_ranking && @@ -706,7 +706,6 @@ def ==(other) replace_synonyms_in_highlight == other.replace_synonyms_in_highlight && min_proximity == other.min_proximity && response_fields == other.response_fields && - max_facet_hits == other.max_facet_hits && max_values_per_facet == other.max_values_per_facet && sort_facet_values_by == other.sort_facet_values_by && attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity && @@ -742,6 +741,7 @@ def hash user_data, custom_normalization, attribute_for_distinct, + max_facet_hits, attributes_to_retrieve, ranking, custom_ranking, @@ -779,7 +779,6 @@ def hash replace_synonyms_in_highlight, min_proximity, response_fields, - max_facet_hits, max_values_per_facet, sort_facet_values_by, attribute_criteria_computed_by_min_proximity, diff --git a/lib/algolia/models/search/inside_bounding_box.rb b/lib/algolia/models/search/inside_bounding_box.rb new file mode 100644 index 00000000..87b7b52c --- /dev/null +++ b/lib/algolia/models/search/inside_bounding_box.rb @@ -0,0 +1,108 @@ +# 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. + +require "date" +require "time" + +module Algolia + module Search + module InsideBoundingBox + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :"Array>", + :"String" + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + # "nullable: true" + next if klass == :AnyType + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + # rescue all errors so we keep iterating even if the current item lookup raises + rescue + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when "Boolean" + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when "Float" + return data if data.instance_of?(Float) + when "Integer" + return data if data.instance_of?(Integer) + when "Time" + return Time.parse(data) + when "Date" + return Date.parse(data) + when "String" + return data if data.instance_of?(String) + # "type: object" + when "Object" + return data if data.instance_of?(Hash) + # "type: array" + when /\AArray<(?.+)>\z/ + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + # "type: object" with "additionalProperties: { ... }" + when /\AHash.+)>\z/ + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + # model + else + const = Algolia::Search.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) + # nested oneOf model + model = const.build(data) + elsif const.respond_to?(:acceptable_attributes) + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + else + # maybe it's an enum + model = const.build_from_hash(data) + end + + return model if model + end + end + + # if no match by now, raise + raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + + end +end diff --git a/lib/algolia/models/search/optional_words.rb b/lib/algolia/models/search/optional_words.rb new file mode 100644 index 00000000..900b19a9 --- /dev/null +++ b/lib/algolia/models/search/optional_words.rb @@ -0,0 +1,108 @@ +# 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. + +require "date" +require "time" + +module Algolia + module Search + module OptionalWords + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :"Array", + :"String" + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + # "nullable: true" + next if klass == :AnyType + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + # rescue all errors so we keep iterating even if the current item lookup raises + rescue + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when "Boolean" + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when "Float" + return data if data.instance_of?(Float) + when "Integer" + return data if data.instance_of?(Integer) + when "Time" + return Time.parse(data) + when "Date" + return Date.parse(data) + when "String" + return data if data.instance_of?(String) + # "type: object" + when "Object" + return data if data.instance_of?(Hash) + # "type: array" + when /\AArray<(?.+)>\z/ + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + # "type: object" with "additionalProperties: { ... }" + when /\AHash.+)>\z/ + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + # model + else + const = Algolia::Search.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) + # nested oneOf model + model = const.build(data) + elsif const.respond_to?(:acceptable_attributes) + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + else + # maybe it's an enum + model = const.build_from_hash(data) + end + + return model if model + end + end + + # if no match by now, raise + raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + + end +end diff --git a/lib/algolia/models/search/search_for_facets.rb b/lib/algolia/models/search/search_for_facets.rb index f44a237f..800c015c 100644 --- a/lib/algolia/models/search/search_for_facets.rb +++ b/lib/algolia/models/search/search_for_facets.rb @@ -60,7 +60,6 @@ class SearchForFacets # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. attr_accessor :minimum_around_radius - # Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). attr_accessor :inside_bounding_box # 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`. @@ -176,7 +175,6 @@ class SearchForFacets # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. attr_accessor :advanced_syntax - # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). attr_accessor :optional_words # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. @@ -201,9 +199,6 @@ class SearchForFacets # 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. attr_accessor :response_fields - # 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). - attr_accessor :max_facet_hits - # Maximum number of facet values to return for each facet. attr_accessor :max_values_per_facet @@ -229,6 +224,9 @@ class SearchForFacets # Text to search inside the facet's values. attr_accessor :facet_query + # 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). + attr_accessor :max_facet_hits + attr_accessor :type # Attribute mapping from ruby-style variable name to JSON key. @@ -304,7 +302,6 @@ def self.attribute_map :replace_synonyms_in_highlight => :replaceSynonymsInHighlight, :min_proximity => :minProximity, :response_fields => :responseFields, - :max_facet_hits => :maxFacetHits, :max_values_per_facet => :maxValuesPerFacet, :sort_facet_values_by => :sortFacetValuesBy, :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity, @@ -314,6 +311,7 @@ def self.attribute_map :facet => :facet, :index_name => :indexName, :facet_query => :facetQuery, + :max_facet_hits => :maxFacetHits, :type => :type } end @@ -346,7 +344,7 @@ def self.types_mapping :around_radius => :"AroundRadius", :around_precision => :"AroundPrecision", :minimum_around_radius => :"Integer", - :inside_bounding_box => :"Array>", + :inside_bounding_box => :"InsideBoundingBox", :inside_polygon => :"Array>", :natural_languages => :"Array", :rule_contexts => :"Array", @@ -387,7 +385,7 @@ def self.types_mapping :mode => :"Mode", :semantic_search => :"SemanticSearch", :advanced_syntax => :"Boolean", - :optional_words => :"Array", + :optional_words => :"OptionalWords", :disable_exact_on_attributes => :"Array", :exact_on_single_word_query => :"ExactOnSingleWordQuery", :alternatives_as_exact => :"Array", @@ -396,7 +394,6 @@ def self.types_mapping :replace_synonyms_in_highlight => :"Boolean", :min_proximity => :"Integer", :response_fields => :"Array", - :max_facet_hits => :"Integer", :max_values_per_facet => :"Integer", :sort_facet_values_by => :"String", :attribute_criteria_computed_by_min_proximity => :"Boolean", @@ -406,6 +403,7 @@ def self.types_mapping :facet => :"String", :index_name => :"String", :facet_query => :"String", + :max_facet_hits => :"Integer", :type => :"SearchTypeFacet" } end @@ -413,7 +411,10 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :inside_bounding_box, + :optional_words + ] ) end @@ -533,9 +534,7 @@ def initialize(attributes = {}) end if attributes.key?(:inside_bounding_box) - if (value = attributes[:inside_bounding_box]).is_a?(Array) - self.inside_bounding_box = value - end + self.inside_bounding_box = attributes[:inside_bounding_box] end if attributes.key?(:inside_polygon) @@ -721,9 +720,7 @@ def initialize(attributes = {}) end if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end + self.optional_words = attributes[:optional_words] end if attributes.key?(:disable_exact_on_attributes) @@ -766,10 +763,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:max_facet_hits) - self.max_facet_hits = attributes[:max_facet_hits] - end - if attributes.key?(:max_values_per_facet) self.max_values_per_facet = attributes[:max_values_per_facet] end @@ -810,6 +803,10 @@ def initialize(attributes = {}) self.facet_query = attributes[:facet_query] end + if attributes.key?(:max_facet_hits) + self.max_facet_hits = attributes[:max_facet_hits] + end + if attributes.key?(:type) self.type = attributes[:type] else @@ -892,7 +889,6 @@ def ==(other) replace_synonyms_in_highlight == other.replace_synonyms_in_highlight && min_proximity == other.min_proximity && response_fields == other.response_fields && - max_facet_hits == other.max_facet_hits && max_values_per_facet == other.max_values_per_facet && sort_facet_values_by == other.sort_facet_values_by && attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity && @@ -902,6 +898,7 @@ def ==(other) facet == other.facet && index_name == other.index_name && facet_query == other.facet_query && + max_facet_hits == other.max_facet_hits && type == other.type end @@ -985,7 +982,6 @@ def hash replace_synonyms_in_highlight, min_proximity, response_fields, - max_facet_hits, max_values_per_facet, sort_facet_values_by, attribute_criteria_computed_by_min_proximity, @@ -995,6 +991,7 @@ def hash facet, index_name, facet_query, + max_facet_hits, type ].hash end diff --git a/lib/algolia/models/search/search_for_hits.rb b/lib/algolia/models/search/search_for_hits.rb index a1fe5f6e..2a4b5081 100644 --- a/lib/algolia/models/search/search_for_hits.rb +++ b/lib/algolia/models/search/search_for_hits.rb @@ -60,7 +60,6 @@ class SearchForHits # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. attr_accessor :minimum_around_radius - # Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). attr_accessor :inside_bounding_box # 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`. @@ -176,7 +175,6 @@ class SearchForHits # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. attr_accessor :advanced_syntax - # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). attr_accessor :optional_words # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. @@ -201,9 +199,6 @@ class SearchForHits # 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. attr_accessor :response_fields - # 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). - attr_accessor :max_facet_hits - # Maximum number of facet values to return for each facet. attr_accessor :max_values_per_facet @@ -298,7 +293,6 @@ def self.attribute_map :replace_synonyms_in_highlight => :replaceSynonymsInHighlight, :min_proximity => :minProximity, :response_fields => :responseFields, - :max_facet_hits => :maxFacetHits, :max_values_per_facet => :maxValuesPerFacet, :sort_facet_values_by => :sortFacetValuesBy, :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity, @@ -338,7 +332,7 @@ def self.types_mapping :around_radius => :"AroundRadius", :around_precision => :"AroundPrecision", :minimum_around_radius => :"Integer", - :inside_bounding_box => :"Array>", + :inside_bounding_box => :"InsideBoundingBox", :inside_polygon => :"Array>", :natural_languages => :"Array", :rule_contexts => :"Array", @@ -379,7 +373,7 @@ def self.types_mapping :mode => :"Mode", :semantic_search => :"SemanticSearch", :advanced_syntax => :"Boolean", - :optional_words => :"Array", + :optional_words => :"OptionalWords", :disable_exact_on_attributes => :"Array", :exact_on_single_word_query => :"ExactOnSingleWordQuery", :alternatives_as_exact => :"Array", @@ -388,7 +382,6 @@ def self.types_mapping :replace_synonyms_in_highlight => :"Boolean", :min_proximity => :"Integer", :response_fields => :"Array", - :max_facet_hits => :"Integer", :max_values_per_facet => :"Integer", :sort_facet_values_by => :"String", :attribute_criteria_computed_by_min_proximity => :"Boolean", @@ -403,7 +396,10 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :inside_bounding_box, + :optional_words + ] ) end @@ -523,9 +519,7 @@ def initialize(attributes = {}) end if attributes.key?(:inside_bounding_box) - if (value = attributes[:inside_bounding_box]).is_a?(Array) - self.inside_bounding_box = value - end + self.inside_bounding_box = attributes[:inside_bounding_box] end if attributes.key?(:inside_polygon) @@ -711,9 +705,7 @@ def initialize(attributes = {}) end if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end + self.optional_words = attributes[:optional_words] end if attributes.key?(:disable_exact_on_attributes) @@ -756,10 +748,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:max_facet_hits) - self.max_facet_hits = attributes[:max_facet_hits] - end - if attributes.key?(:max_values_per_facet) self.max_values_per_facet = attributes[:max_values_per_facet] end @@ -870,7 +858,6 @@ def ==(other) replace_synonyms_in_highlight == other.replace_synonyms_in_highlight && min_proximity == other.min_proximity && response_fields == other.response_fields && - max_facet_hits == other.max_facet_hits && max_values_per_facet == other.max_values_per_facet && sort_facet_values_by == other.sort_facet_values_by && attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity && @@ -961,7 +948,6 @@ def hash replace_synonyms_in_highlight, min_proximity, response_fields, - max_facet_hits, max_values_per_facet, sort_facet_values_by, attribute_criteria_computed_by_min_proximity, diff --git a/lib/algolia/models/search/search_params_object.rb b/lib/algolia/models/search/search_params_object.rb index 7c5618cc..6dcce24d 100644 --- a/lib/algolia/models/search/search_params_object.rb +++ b/lib/algolia/models/search/search_params_object.rb @@ -58,7 +58,6 @@ class SearchParamsObject # Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. attr_accessor :minimum_around_radius - # Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). attr_accessor :inside_bounding_box # 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`. @@ -174,7 +173,6 @@ class SearchParamsObject # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. attr_accessor :advanced_syntax - # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). attr_accessor :optional_words # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. @@ -199,9 +197,6 @@ class SearchParamsObject # 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. attr_accessor :response_fields - # 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). - attr_accessor :max_facet_hits - # Maximum number of facet values to return for each facet. attr_accessor :max_values_per_facet @@ -290,7 +285,6 @@ def self.attribute_map :replace_synonyms_in_highlight => :replaceSynonymsInHighlight, :min_proximity => :minProximity, :response_fields => :responseFields, - :max_facet_hits => :maxFacetHits, :max_values_per_facet => :maxValuesPerFacet, :sort_facet_values_by => :sortFacetValuesBy, :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity, @@ -327,7 +321,7 @@ def self.types_mapping :around_radius => :"AroundRadius", :around_precision => :"AroundPrecision", :minimum_around_radius => :"Integer", - :inside_bounding_box => :"Array>", + :inside_bounding_box => :"InsideBoundingBox", :inside_polygon => :"Array>", :natural_languages => :"Array", :rule_contexts => :"Array", @@ -368,7 +362,7 @@ def self.types_mapping :mode => :"Mode", :semantic_search => :"SemanticSearch", :advanced_syntax => :"Boolean", - :optional_words => :"Array", + :optional_words => :"OptionalWords", :disable_exact_on_attributes => :"Array", :exact_on_single_word_query => :"ExactOnSingleWordQuery", :alternatives_as_exact => :"Array", @@ -377,7 +371,6 @@ def self.types_mapping :replace_synonyms_in_highlight => :"Boolean", :min_proximity => :"Integer", :response_fields => :"Array", - :max_facet_hits => :"Integer", :max_values_per_facet => :"Integer", :sort_facet_values_by => :"String", :attribute_criteria_computed_by_min_proximity => :"Boolean", @@ -390,7 +383,10 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :inside_bounding_box, + :optional_words + ] ) end @@ -506,9 +502,7 @@ def initialize(attributes = {}) end if attributes.key?(:inside_bounding_box) - if (value = attributes[:inside_bounding_box]).is_a?(Array) - self.inside_bounding_box = value - end + self.inside_bounding_box = attributes[:inside_bounding_box] end if attributes.key?(:inside_polygon) @@ -694,9 +688,7 @@ def initialize(attributes = {}) end if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end + self.optional_words = attributes[:optional_words] end if attributes.key?(:disable_exact_on_attributes) @@ -739,10 +731,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:max_facet_hits) - self.max_facet_hits = attributes[:max_facet_hits] - end - if attributes.key?(:max_values_per_facet) self.max_values_per_facet = attributes[:max_values_per_facet] end @@ -842,7 +830,6 @@ def ==(other) replace_synonyms_in_highlight == other.replace_synonyms_in_highlight && min_proximity == other.min_proximity && response_fields == other.response_fields && - max_facet_hits == other.max_facet_hits && max_values_per_facet == other.max_values_per_facet && sort_facet_values_by == other.sort_facet_values_by && attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity && @@ -930,7 +917,6 @@ def hash replace_synonyms_in_highlight, min_proximity, response_fields, - max_facet_hits, max_values_per_facet, sort_facet_values_by, attribute_criteria_computed_by_min_proximity, diff --git a/lib/algolia/models/search/settings_response.rb b/lib/algolia/models/search/settings_response.rb index 4387c75f..de735c5c 100644 --- a/lib/algolia/models/search/settings_response.rb +++ b/lib/algolia/models/search/settings_response.rb @@ -57,6 +57,9 @@ class SettingsResponse # Attribute that should be used to establish groups of results. Attribute names are case-sensitive. All records with the same value for this attribute are considered a group. You can combine `attributeForDistinct` with the `distinct` search parameter to control how many items per group are included in the search results. If you want to use the same attribute also for faceting, use the `afterDistinct` modifier of the `attributesForFaceting` setting. This applies faceting _after_ deduplication, which will result in accurate facet counts. attr_accessor :attribute_for_distinct + # 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). + attr_accessor :max_facet_hits + # 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. attr_accessor :attributes_to_retrieve @@ -134,7 +137,6 @@ class SettingsResponse # Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. attr_accessor :advanced_syntax - # Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). attr_accessor :optional_words # Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. @@ -159,9 +161,6 @@ class SettingsResponse # 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. attr_accessor :response_fields - # 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). - attr_accessor :max_facet_hits - # Maximum number of facet values to return for each facet. attr_accessor :max_values_per_facet @@ -201,6 +200,7 @@ def self.attribute_map :user_data => :userData, :custom_normalization => :customNormalization, :attribute_for_distinct => :attributeForDistinct, + :max_facet_hits => :maxFacetHits, :attributes_to_retrieve => :attributesToRetrieve, :ranking => :ranking, :custom_ranking => :customRanking, @@ -238,7 +238,6 @@ def self.attribute_map :replace_synonyms_in_highlight => :replaceSynonymsInHighlight, :min_proximity => :minProximity, :response_fields => :responseFields, - :max_facet_hits => :maxFacetHits, :max_values_per_facet => :maxValuesPerFacet, :sort_facet_values_by => :sortFacetValuesBy, :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity, @@ -274,6 +273,7 @@ def self.types_mapping :user_data => :"Object", :custom_normalization => :"Hash>", :attribute_for_distinct => :"String", + :max_facet_hits => :"Integer", :attributes_to_retrieve => :"Array", :ranking => :"Array", :custom_ranking => :"Array", @@ -302,7 +302,7 @@ def self.types_mapping :mode => :"Mode", :semantic_search => :"SemanticSearch", :advanced_syntax => :"Boolean", - :optional_words => :"Array", + :optional_words => :"OptionalWords", :disable_exact_on_attributes => :"Array", :exact_on_single_word_query => :"ExactOnSingleWordQuery", :alternatives_as_exact => :"Array", @@ -311,7 +311,6 @@ def self.types_mapping :replace_synonyms_in_highlight => :"Boolean", :min_proximity => :"Integer", :response_fields => :"Array", - :max_facet_hits => :"Integer", :max_values_per_facet => :"Integer", :sort_facet_values_by => :"String", :attribute_criteria_computed_by_min_proximity => :"Boolean", @@ -325,7 +324,9 @@ def self.types_mapping # List of attributes with nullable: true def self.openapi_nullable Set.new( - [] + [ + :optional_words + ] ) end @@ -450,6 +451,10 @@ def initialize(attributes = {}) self.attribute_for_distinct = attributes[:attribute_for_distinct] end + if attributes.key?(:max_facet_hits) + self.max_facet_hits = attributes[:max_facet_hits] + end + if attributes.key?(:attributes_to_retrieve) if (value = attributes[:attributes_to_retrieve]).is_a?(Array) self.attributes_to_retrieve = value @@ -577,9 +582,7 @@ def initialize(attributes = {}) end if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end + self.optional_words = attributes[:optional_words] end if attributes.key?(:disable_exact_on_attributes) @@ -622,10 +625,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:max_facet_hits) - self.max_facet_hits = attributes[:max_facet_hits] - end - if attributes.key?(:max_values_per_facet) self.max_values_per_facet = attributes[:max_values_per_facet] end @@ -677,6 +676,7 @@ def ==(other) user_data == other.user_data && custom_normalization == other.custom_normalization && attribute_for_distinct == other.attribute_for_distinct && + max_facet_hits == other.max_facet_hits && attributes_to_retrieve == other.attributes_to_retrieve && ranking == other.ranking && custom_ranking == other.custom_ranking && @@ -714,7 +714,6 @@ def ==(other) replace_synonyms_in_highlight == other.replace_synonyms_in_highlight && min_proximity == other.min_proximity && response_fields == other.response_fields && - max_facet_hits == other.max_facet_hits && max_values_per_facet == other.max_values_per_facet && sort_facet_values_by == other.sort_facet_values_by && attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity && @@ -751,6 +750,7 @@ def hash user_data, custom_normalization, attribute_for_distinct, + max_facet_hits, attributes_to_retrieve, ranking, custom_ranking, @@ -788,7 +788,6 @@ def hash replace_synonyms_in_highlight, min_proximity, response_fields, - max_facet_hits, max_values_per_facet, sort_facet_values_by, attribute_criteria_computed_by_min_proximity,