diff --git a/lib/algolia/api/ingestion_client.rb b/lib/algolia/api/ingestion_client.rb index 97e72910..559067c4 100644 --- a/lib/algolia/api/ingestion_client.rb +++ b/lib/algolia/api/ingestion_client.rb @@ -961,60 +961,6 @@ def enable_task_v1(task_id, request_options = {}) @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::TaskUpdateResponse") end - # Generates code for the selected model based on the given prompt. - # - # Required API Key ACLs: - # - addObject - # - deleteIndex - # - editSettings - # @param generate_transformation_code_payload [GenerateTransformationCodePayload] (required) - # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - # @return [Http::Response] the response - def generate_transformation_code_with_http_info(generate_transformation_code_payload, request_options = {}) - # verify the required parameter 'generate_transformation_code_payload' is set - if @api_client.config.client_side_validation && generate_transformation_code_payload.nil? - raise( - ArgumentError, - "Parameter `generate_transformation_code_payload` is required when calling `generate_transformation_code`." - ) - end - - path = "/1/transformations/models" - query_params = {} - query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil? - header_params = {} - header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil? - - post_body = request_options[:debug_body] || @api_client.object_to_http_body(generate_transformation_code_payload) - - new_options = request_options.merge( - :operation => :"IngestionClient.generate_transformation_code", - :header_params => header_params, - :query_params => query_params, - :body => post_body, - :use_read_transporter => false - ) - - @api_client.call_api(:POST, path, new_options) - end - - # Generates code for the selected model based on the given prompt. - # - # Required API Key ACLs: - # - addObject - # - deleteIndex - # - editSettings - # @param generate_transformation_code_payload [GenerateTransformationCodePayload] (required) - # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - # @return [GenerateTransformationCodeResponse] - def generate_transformation_code(generate_transformation_code_payload, request_options = {}) - response = generate_transformation_code_with_http_info(generate_transformation_code_payload, request_options) - @api_client.deserialize( - response.body, - request_options[:debug_return_type] || "Ingestion::GenerateTransformationCodeResponse" - ) - end - # Retrieves an authentication resource by its ID. # # Required API Key ACLs: @@ -2231,47 +2177,6 @@ def list_tasks_v1( @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::ListTasksResponseV1") end - # Retrieves a list of existing LLM transformation helpers. - # - # Required API Key ACLs: - # - addObject - # - deleteIndex - # - editSettings - # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - # @return [Http::Response] the response - def list_transformation_models_with_http_info(request_options = {}) - path = "/1/transformations/models" - query_params = {} - query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil? - header_params = {} - header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil? - - post_body = request_options[:debug_body] - - new_options = request_options.merge( - :operation => :"IngestionClient.list_transformation_models", - :header_params => header_params, - :query_params => query_params, - :body => post_body, - :use_read_transporter => false - ) - - @api_client.call_api(:GET, path, new_options) - end - - # Retrieves a list of existing LLM transformation helpers. - # - # Required API Key ACLs: - # - addObject - # - deleteIndex - # - editSettings - # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - # @return [TransformationModels] - def list_transformation_models(request_options = {}) - response = list_transformation_models_with_http_info(request_options) - @api_client.deserialize(response.body, request_options[:debug_return_type] || "Ingestion::TransformationModels") - end - # Retrieves a list of transformations. # # Required API Key ACLs: diff --git a/lib/algolia/models/ingestion/generate_transformation_code_payload.rb b/lib/algolia/models/ingestion/generate_transformation_code_payload.rb deleted file mode 100644 index c7bac2ea..00000000 --- a/lib/algolia/models/ingestion/generate_transformation_code_payload.rb +++ /dev/null @@ -1,233 +0,0 @@ -# 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 Ingestion - class GenerateTransformationCodePayload - attr_accessor :id - - attr_accessor :system_prompt - - attr_accessor :user_prompt - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :id => :id, - :system_prompt => :systemPrompt, - :user_prompt => :userPrompt - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.types_mapping - { - :id => :"String", - :system_prompt => :"String", - :user_prompt => :"String" - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new( - [] - ) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - raise( - ArgumentError, - "The input argument (attributes) must be a hash in `Algolia::GenerateTransformationCodePayload` initialize method" - ) - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - raise( - ArgumentError, - "`#{k}` is not a valid attribute in `Algolia::GenerateTransformationCodePayload`. Please check the name to make sure it's valid. List of attributes: " + - self.class.attribute_map.keys.inspect - ) - end - - h[k.to_sym] = v - } - - if attributes.key?(:id) - self.id = attributes[:id] - else - self.id = nil - end - - if attributes.key?(:system_prompt) - self.system_prompt = attributes[:system_prompt] - end - - if attributes.key?(:user_prompt) - self.user_prompt = attributes[:user_prompt] - else - self.user_prompt = nil - end - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.equal?(other) - self.class == other.class && - id == other.id && - system_prompt == other.system_prompt && - user_prompt == other.user_prompt - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, system_prompt, user_prompt].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - types_mapping.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| - _deserialize(::Regexp.last_match(1), v) - } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]]) - end - end - - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - # model - else - # models (e.g. Pet) or oneOf - klass = Algolia::Ingestion.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass - .build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - def to_json(*_args) - to_hash.to_json - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to?(:to_hash) - value.to_hash - else - value - end - end - - end - - end -end diff --git a/lib/algolia/models/ingestion/generate_transformation_code_response.rb b/lib/algolia/models/ingestion/generate_transformation_code_response.rb deleted file mode 100644 index beb0e91f..00000000 --- a/lib/algolia/models/ingestion/generate_transformation_code_response.rb +++ /dev/null @@ -1,211 +0,0 @@ -# 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 Ingestion - class GenerateTransformationCodeResponse - attr_accessor :generated_code - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :generated_code => :generatedCode - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.types_mapping - { - :generated_code => :"String" - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new( - [] - ) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - raise( - ArgumentError, - "The input argument (attributes) must be a hash in `Algolia::GenerateTransformationCodeResponse` initialize method" - ) - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - raise( - ArgumentError, - "`#{k}` is not a valid attribute in `Algolia::GenerateTransformationCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + - self.class.attribute_map.keys.inspect - ) - end - - h[k.to_sym] = v - } - - if attributes.key?(:generated_code) - self.generated_code = attributes[:generated_code] - end - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.equal?(other) - self.class == other.class && - generated_code == other.generated_code - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [generated_code].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - types_mapping.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| - _deserialize(::Regexp.last_match(1), v) - } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]]) - end - end - - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - # model - else - # models (e.g. Pet) or oneOf - klass = Algolia::Ingestion.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass - .build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - def to_json(*_args) - to_hash.to_json - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to?(:to_hash) - value.to_hash - else - value - end - end - - end - - end -end diff --git a/lib/algolia/models/ingestion/model.rb b/lib/algolia/models/ingestion/model.rb deleted file mode 100644 index 74ae9954..00000000 --- a/lib/algolia/models/ingestion/model.rb +++ /dev/null @@ -1,254 +0,0 @@ -# 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 Ingestion - class Model - attr_accessor :fullname - - attr_accessor :model_name - - attr_accessor :system_prompt - - attr_accessor :id - - attr_accessor :provider - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :fullname => :fullname, - :model_name => :modelName, - :system_prompt => :systemPrompt, - :id => :id, - :provider => :provider - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.types_mapping - { - :fullname => :"String", - :model_name => :"String", - :system_prompt => :"String", - :id => :"String", - :provider => :"String" - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new( - [] - ) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::Model` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - raise( - ArgumentError, - "`#{k}` is not a valid attribute in `Algolia::Model`. Please check the name to make sure it's valid. List of attributes: " + - self.class.attribute_map.keys.inspect - ) - end - - h[k.to_sym] = v - } - - if attributes.key?(:fullname) - self.fullname = attributes[:fullname] - else - self.fullname = nil - end - - if attributes.key?(:model_name) - self.model_name = attributes[:model_name] - else - self.model_name = nil - end - - if attributes.key?(:system_prompt) - self.system_prompt = attributes[:system_prompt] - else - self.system_prompt = nil - end - - if attributes.key?(:id) - self.id = attributes[:id] - else - self.id = nil - end - - if attributes.key?(:provider) - self.provider = attributes[:provider] - else - self.provider = nil - end - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.equal?(other) - self.class == other.class && - fullname == other.fullname && - model_name == other.model_name && - system_prompt == other.system_prompt && - id == other.id && - provider == other.provider - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [fullname, model_name, system_prompt, id, provider].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - types_mapping.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| - _deserialize(::Regexp.last_match(1), v) - } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]]) - end - end - - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - # model - else - # models (e.g. Pet) or oneOf - klass = Algolia::Ingestion.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass - .build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - def to_json(*_args) - to_hash.to_json - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to?(:to_hash) - value.to_hash - else - value - end - end - - end - - end -end diff --git a/lib/algolia/models/ingestion/transformation_models.rb b/lib/algolia/models/ingestion/transformation_models.rb deleted file mode 100644 index 23c0e2b1..00000000 --- a/lib/algolia/models/ingestion/transformation_models.rb +++ /dev/null @@ -1,216 +0,0 @@ -# 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 Ingestion - # List of available AI models for transformation purposes. - class TransformationModels - attr_accessor :llms - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :llms => :llms - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.types_mapping - { - :llms => :"Array" - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new( - [] - ) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - raise( - ArgumentError, - "The input argument (attributes) must be a hash in `Algolia::TransformationModels` initialize method" - ) - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - raise( - ArgumentError, - "`#{k}` is not a valid attribute in `Algolia::TransformationModels`. Please check the name to make sure it's valid. List of attributes: " + - self.class.attribute_map.keys.inspect - ) - end - - h[k.to_sym] = v - } - - if attributes.key?(:llms) - if (value = attributes[:llms]).is_a?(Array) - self.llms = value - end - else - self.llms = nil - end - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.equal?(other) - self.class == other.class && - llms == other.llms - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [llms].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - types_mapping.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| - _deserialize(::Regexp.last_match(1), v) - } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]]) - end - end - - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - # model - else - # models (e.g. Pet) or oneOf - klass = Algolia::Ingestion.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass - .build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - def to_json(*_args) - to_hash.to_json - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to?(:to_hash) - value.to_hash - else - value - end - end - - end - - end -end diff --git a/lib/algolia/models/recommend/bought_together_query.rb b/lib/algolia/models/recommend/bought_together_query.rb index 71295004..78b06fba 100644 --- a/lib/algolia/models/recommend/bought_together_query.rb +++ b/lib/algolia/models/recommend/bought_together_query.rb @@ -45,7 +45,7 @@ def self.types_mapping :index_name => :"String", :threshold => :"Float", :max_recommendations => :"Integer", - :query_parameters => :"SearchParams", + :query_parameters => :"RecommendSearchParams", :model => :"FbtModel", :object_id => :"String" } diff --git a/lib/algolia/models/recommend/facet_ordering.rb b/lib/algolia/models/recommend/facet_ordering.rb index 7bc43ebd..09d3248c 100644 --- a/lib/algolia/models/recommend/facet_ordering.rb +++ b/lib/algolia/models/recommend/facet_ordering.rb @@ -28,7 +28,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.types_mapping { - :facets => :"Facets", + :facets => :"IndexSettingsFacets", :values => :"Hash" } end diff --git a/lib/algolia/models/recommend/fallback_params.rb b/lib/algolia/models/recommend/fallback_params.rb index d4e89612..cf39def9 100644 --- a/lib/algolia/models/recommend/fallback_params.rb +++ b/lib/algolia/models/recommend/fallback_params.rb @@ -6,9 +6,6 @@ module Algolia module Recommend class FallbackParams - # Search query. - attr_accessor :query - # Keywords to be used instead of the search query to conduct a more broader search. Using the `similarQuery` parameter changes other settings: - `queryType` is set to `prefixNone`. - `removeStopWords` is set to true. - `words` is set as the first ranking criterion. - All remaining words are treated as `optionalWords`. Since the `similarQuery` is supposed to do a broad search, they usually return many results. Combine it with `filters` to narrow down the list of results. attr_accessor :similar_query @@ -35,15 +32,6 @@ class FallbackParams # Whether faceting should be applied after deduplication with `distinct`. This leads to accurate facet counts when using faceting in combination with `distinct`. It's usually better to use `afterDistinct` modifiers in the `attributesForFaceting` setting, as `facetingAfterDistinct` only computes correct facet counts if all records have the same facet values for the `attributeForDistinct`. attr_accessor :faceting_after_distinct - # Page of search results to retrieve. - attr_accessor :page - - # Position of the first hit to retrieve. - attr_accessor :offset - - # Number of hits to retrieve (used in combination with `offset`). - attr_accessor :length - # Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude. Only records included within circle around this central location are included in the results. The radius of the circle is determined by the `aroundRadius` and `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` or `insideBoundingBox`. attr_accessor :around_lat_lng @@ -96,15 +84,66 @@ class FallbackParams # Whether to enable A/B testing for this search. attr_accessor :enable_ab_test + # Search query. + attr_accessor :query + + # Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/). Facets are attributes that let you categorize search results. They can be used for filtering search results. By default, no attribute is used for faceting. Attribute names are case-sensitive. **Modifiers** - `filterOnly(\"ATTRIBUTE\")`. Allows using this attribute as a filter, but doesn't evalue the facet values. - `searchable(\"ATTRIBUTE\")`. Allows searching for facet values. - `afterDistinct(\"ATTRIBUTE\")`. Evaluates the facet count _after_ deduplication with `distinct`. This ensures accurate facet counts. You can apply this modifier to searchable facets: `afterDistinct(searchable(ATTRIBUTE))`. + attr_accessor :attributes_for_faceting + + # Creates [replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/). Replicas are copies of a primary index with the same records but different settings, synonyms, or rules. If you want to offer a different ranking or sorting of your search results, you'll use replica indices. All index operations on a primary index are automatically forwarded to its replicas. To add a replica index, you must provide the complete set of replicas to this parameter. If you omit a replica from this list, the replica turns into a regular, standalone index that will no longer by synced with the primary index. **Modifier** - `virtual(\"REPLICA\")`. Create a virtual replica, Virtual replicas don't increase the number of records and are optimized for [Relevant sorting](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/relevant-sort/). + attr_accessor :replicas + + # Maximum number of search results that can be obtained through pagination. Higher pagination limits might slow down your search. For pagination limits above 1,000, the sorting of results beyond the 1,000th hit can't be guaranteed. + attr_accessor :pagination_limited_to + + # Attributes that can't be retrieved at query time. This can be useful if you want to use an attribute for ranking or to [restrict access](https://www.algolia.com/doc/guides/security/api-keys/how-to/user-restricted-access-to-data/), but don't want to include it in the search results. Attribute names are case-sensitive. + attr_accessor :unretrievable_attributes + + # Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). This also turns off [word splitting and concatenation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/splitting-and-concatenation/) for the specified words. + attr_accessor :disable_typo_tolerance_on_words + + # Attributes, for which you want to support [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead). Transliteration supports searching in any of the Japanese writing systems. To support transliteration, you must set the indexing language to Japanese. Attribute names are case-sensitive. + attr_accessor :attributes_to_transliterate + + # Attributes for which to split [camel case](https://wikipedia.org/wiki/Camel_case) words. Attribute names are case-sensitive. + attr_accessor :camel_case_attributes + + # Searchable attributes to which Algolia should apply [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding). Attribute names are case-sensitive. Compound words are formed by combining two or more individual words, and are particularly prevalent in Germanic languages—for example, \"firefighter\". With decompounding, the individual components are indexed separately. You can specify different lists for different languages. Decompounding is supported for these languages: Dutch (`nl`), German (`de`), Finnish (`fi`), Danish (`da`), Swedish (`sv`), and Norwegian (`no`). Decompounding doesn't work for words with [non-spacing mark Unicode characters](https://www.charactercodes.net/category/non-spacing_mark). For example, `Gartenstühle` won't be decompounded if the `ü` consists of `u` (U+0075) and `◌̈` (U+0308). + attr_accessor :decompounded_attributes + + # Languages for language-specific processing steps, such as word detection and dictionary settings. **You should always specify an indexing language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/). + attr_accessor :index_languages + + # Searchable attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search). Attribute names are case-sensitive. + attr_accessor :disable_prefix_on_attributes + + # Whether arrays with exclusively non-negative integers should be compressed for better performance. If true, the compressed arrays may be reordered. + attr_accessor :allow_compression_of_integer_array + + # Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters). Attribute names are case-sensitive. By default, all numeric attributes are available as numerical filters. For faster indexing, reduce the number of numeric attributes. If you want to turn off filtering for all numeric attributes, specifiy an attribute that doesn't exist in your index, such as `NO_NUMERIC_FILTERING`. **Modifier** - `equalOnly(\"ATTRIBUTE\")`. Support only filtering based on equality comparisons `=` and `!=`. + attr_accessor :numeric_attributes_for_filtering + + # Controls which separators are indexed. Separators are all non-letter characters except spaces and currency characters, such as $€£¥. By default, separator characters aren't indexed. With `separatorsToIndex`, Algolia treats separator characters as separate words. For example, a search for `C#` would report two matches. + attr_accessor :separators_to_index + + # Attributes used for searching. Attribute names are case-sensitive. By default, all attributes are searchable and the [Attribute](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute) ranking criterion is turned off. With a non-empty list, Algolia only returns results with matches in the selected attributes. In addition, the Attribute ranking criterion is turned on: matches in attributes that are higher in the list of `searchableAttributes` rank first. To make matches in two attributes rank equally, include them in a comma-separated string, such as `\"title,alternate_title\"`. Attributes with the same priority are always unordered. For more information, see [Searchable attributes](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/setting-searchable-attributes/). **Modifier** - `unordered(\"ATTRIBUTE\")`. Ignore the position of a match within the attribute. Without modifier, matches at the beginning of an attribute rank higer than matches at the end. + attr_accessor :searchable_attributes + + # An object with custom data. You can store up to 32kB as custom data. + attr_accessor :user_data + + # Characters and their normalized replacements. This overrides Algolia's default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + attr_accessor :custom_normalization + + # 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 + # 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 # Determines the order in which Algolia returns your results. By default, each entry corresponds to a [ranking criteria](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). The tie-breaking algorithm sequentially applies each criterion in the order they're specified. If you configure a replica index for [sorting by an attribute](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-by-attribute/), you put the sorting attribute at the top of the list. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. Before you modify the default setting, you should test your changes in the dashboard, and by [A/B testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/). attr_accessor :ranking - # Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied. - attr_accessor :custom_ranking - # Relevancy threshold below which less relevant results aren't included in the results. You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results. attr_accessor :relevancy_strictness @@ -126,9 +165,6 @@ class FallbackParams # Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted. attr_accessor :restrict_highlight_and_snippet_arrays - # Number of hits per page. - attr_accessor :hits_per_page - # Minimum number of characters a word in the search query must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). attr_accessor :min_word_sizefor1_typo @@ -147,9 +183,6 @@ class FallbackParams attr_accessor :remove_stop_words - # Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics. - attr_accessor :keep_diacritics_on_characters - # Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries. This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first**. **You should always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/). attr_accessor :query_languages @@ -166,10 +199,6 @@ class FallbackParams attr_accessor :remove_words_if_no_results - attr_accessor :mode - - attr_accessor :semantic_search - # 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 @@ -220,7 +249,6 @@ class FallbackParams # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :query => :query, :similar_query => :similarQuery, :filters => :filters, :facet_filters => :facetFilters, @@ -231,9 +259,6 @@ def self.attribute_map :restrict_searchable_attributes => :restrictSearchableAttributes, :facets => :facets, :faceting_after_distinct => :facetingAfterDistinct, - :page => :page, - :offset => :offset, - :length => :length, :around_lat_lng => :aroundLatLng, :around_lat_lng_via_ip => :aroundLatLngViaIP, :around_radius => :aroundRadius, @@ -252,9 +277,26 @@ def self.attribute_map :analytics_tags => :analyticsTags, :percentile_computation => :percentileComputation, :enable_ab_test => :enableABTest, + :query => :query, + :attributes_for_faceting => :attributesForFaceting, + :replicas => :replicas, + :pagination_limited_to => :paginationLimitedTo, + :unretrievable_attributes => :unretrievableAttributes, + :disable_typo_tolerance_on_words => :disableTypoToleranceOnWords, + :attributes_to_transliterate => :attributesToTransliterate, + :camel_case_attributes => :camelCaseAttributes, + :decompounded_attributes => :decompoundedAttributes, + :index_languages => :indexLanguages, + :disable_prefix_on_attributes => :disablePrefixOnAttributes, + :allow_compression_of_integer_array => :allowCompressionOfIntegerArray, + :numeric_attributes_for_filtering => :numericAttributesForFiltering, + :separators_to_index => :separatorsToIndex, + :searchable_attributes => :searchableAttributes, + :user_data => :userData, + :custom_normalization => :customNormalization, + :attribute_for_distinct => :attributeForDistinct, :attributes_to_retrieve => :attributesToRetrieve, :ranking => :ranking, - :custom_ranking => :customRanking, :relevancy_strictness => :relevancyStrictness, :attributes_to_highlight => :attributesToHighlight, :attributes_to_snippet => :attributesToSnippet, @@ -262,7 +304,6 @@ def self.attribute_map :highlight_post_tag => :highlightPostTag, :snippet_ellipsis_text => :snippetEllipsisText, :restrict_highlight_and_snippet_arrays => :restrictHighlightAndSnippetArrays, - :hits_per_page => :hitsPerPage, :min_word_sizefor1_typo => :minWordSizefor1Typo, :min_word_sizefor2_typos => :minWordSizefor2Typos, :typo_tolerance => :typoTolerance, @@ -270,15 +311,12 @@ def self.attribute_map :disable_typo_tolerance_on_attributes => :disableTypoToleranceOnAttributes, :ignore_plurals => :ignorePlurals, :remove_stop_words => :removeStopWords, - :keep_diacritics_on_characters => :keepDiacriticsOnCharacters, :query_languages => :queryLanguages, :decompound_query => :decompoundQuery, :enable_rules => :enableRules, :enable_personalization => :enablePersonalization, :query_type => :queryType, :remove_words_if_no_results => :removeWordsIfNoResults, - :mode => :mode, - :semantic_search => :semanticSearch, :advanced_syntax => :advancedSyntax, :optional_words => :optionalWords, :disable_exact_on_attributes => :disableExactOnAttributes, @@ -307,7 +345,6 @@ def self.acceptable_attributes # Attribute type mapping. def self.types_mapping { - :query => :"String", :similar_query => :"String", :filters => :"String", :facet_filters => :"FacetFilters", @@ -318,9 +355,6 @@ def self.types_mapping :restrict_searchable_attributes => :"Array", :facets => :"Array", :faceting_after_distinct => :"Boolean", - :page => :"Integer", - :offset => :"Integer", - :length => :"Integer", :around_lat_lng => :"String", :around_lat_lng_via_ip => :"Boolean", :around_radius => :"AroundRadius", @@ -339,9 +373,26 @@ def self.types_mapping :analytics_tags => :"Array", :percentile_computation => :"Boolean", :enable_ab_test => :"Boolean", + :query => :"String", + :attributes_for_faceting => :"Array", + :replicas => :"Array", + :pagination_limited_to => :"Integer", + :unretrievable_attributes => :"Array", + :disable_typo_tolerance_on_words => :"Array", + :attributes_to_transliterate => :"Array", + :camel_case_attributes => :"Array", + :decompounded_attributes => :"Object", + :index_languages => :"Array", + :disable_prefix_on_attributes => :"Array", + :allow_compression_of_integer_array => :"Boolean", + :numeric_attributes_for_filtering => :"Array", + :separators_to_index => :"String", + :searchable_attributes => :"Array", + :user_data => :"Object", + :custom_normalization => :"Hash>", + :attribute_for_distinct => :"String", :attributes_to_retrieve => :"Array", :ranking => :"Array", - :custom_ranking => :"Array", :relevancy_strictness => :"Integer", :attributes_to_highlight => :"Array", :attributes_to_snippet => :"Array", @@ -349,7 +400,6 @@ def self.types_mapping :highlight_post_tag => :"String", :snippet_ellipsis_text => :"String", :restrict_highlight_and_snippet_arrays => :"Boolean", - :hits_per_page => :"Integer", :min_word_sizefor1_typo => :"Integer", :min_word_sizefor2_typos => :"Integer", :typo_tolerance => :"TypoTolerance", @@ -357,15 +407,12 @@ def self.types_mapping :disable_typo_tolerance_on_attributes => :"Array", :ignore_plurals => :"IgnorePlurals", :remove_stop_words => :"RemoveStopWords", - :keep_diacritics_on_characters => :"String", :query_languages => :"Array", :decompound_query => :"Boolean", :enable_rules => :"Boolean", :enable_personalization => :"Boolean", :query_type => :"QueryType", :remove_words_if_no_results => :"RemoveWordsIfNoResults", - :mode => :"Mode", - :semantic_search => :"SemanticSearch", :advanced_syntax => :"Boolean", :optional_words => :"Array", :disable_exact_on_attributes => :"Array", @@ -396,7 +443,7 @@ def self.openapi_nullable # List of class defined in allOf (OpenAPI v3) def self.openapi_all_of [ - :"SearchParamsObject" + :"RecommendSearchParams" ] end @@ -423,10 +470,6 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:query) - self.query = attributes[:query] - end - if attributes.key?(:similar_query) self.similar_query = attributes[:similar_query] end @@ -471,18 +514,6 @@ def initialize(attributes = {}) self.faceting_after_distinct = attributes[:faceting_after_distinct] end - if attributes.key?(:page) - self.page = attributes[:page] - end - - if attributes.key?(:offset) - self.offset = attributes[:offset] - end - - if attributes.key?(:length) - self.length = attributes[:length] - end - if attributes.key?(:around_lat_lng) self.around_lat_lng = attributes[:around_lat_lng] end @@ -565,6 +596,100 @@ def initialize(attributes = {}) self.enable_ab_test = attributes[:enable_ab_test] end + if attributes.key?(:query) + self.query = attributes[:query] + end + + if attributes.key?(:attributes_for_faceting) + if (value = attributes[:attributes_for_faceting]).is_a?(Array) + self.attributes_for_faceting = value + end + end + + if attributes.key?(:replicas) + if (value = attributes[:replicas]).is_a?(Array) + self.replicas = value + end + end + + if attributes.key?(:pagination_limited_to) + self.pagination_limited_to = attributes[:pagination_limited_to] + end + + if attributes.key?(:unretrievable_attributes) + if (value = attributes[:unretrievable_attributes]).is_a?(Array) + self.unretrievable_attributes = value + end + end + + if attributes.key?(:disable_typo_tolerance_on_words) + if (value = attributes[:disable_typo_tolerance_on_words]).is_a?(Array) + self.disable_typo_tolerance_on_words = value + end + end + + if attributes.key?(:attributes_to_transliterate) + if (value = attributes[:attributes_to_transliterate]).is_a?(Array) + self.attributes_to_transliterate = value + end + end + + if attributes.key?(:camel_case_attributes) + if (value = attributes[:camel_case_attributes]).is_a?(Array) + self.camel_case_attributes = value + end + end + + if attributes.key?(:decompounded_attributes) + self.decompounded_attributes = attributes[:decompounded_attributes] + end + + if attributes.key?(:index_languages) + if (value = attributes[:index_languages]).is_a?(Array) + self.index_languages = value + end + end + + if attributes.key?(:disable_prefix_on_attributes) + if (value = attributes[:disable_prefix_on_attributes]).is_a?(Array) + self.disable_prefix_on_attributes = value + end + end + + if attributes.key?(:allow_compression_of_integer_array) + self.allow_compression_of_integer_array = attributes[:allow_compression_of_integer_array] + end + + if attributes.key?(:numeric_attributes_for_filtering) + if (value = attributes[:numeric_attributes_for_filtering]).is_a?(Array) + self.numeric_attributes_for_filtering = value + end + end + + if attributes.key?(:separators_to_index) + self.separators_to_index = attributes[:separators_to_index] + end + + if attributes.key?(:searchable_attributes) + if (value = attributes[:searchable_attributes]).is_a?(Array) + self.searchable_attributes = value + end + end + + if attributes.key?(:user_data) + self.user_data = attributes[:user_data] + end + + if attributes.key?(:custom_normalization) + if (value = attributes[:custom_normalization]).is_a?(Hash) + self.custom_normalization = value + end + end + + if attributes.key?(:attribute_for_distinct) + self.attribute_for_distinct = attributes[:attribute_for_distinct] + end + if attributes.key?(:attributes_to_retrieve) if (value = attributes[:attributes_to_retrieve]).is_a?(Array) self.attributes_to_retrieve = value @@ -577,12 +702,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:custom_ranking) - if (value = attributes[:custom_ranking]).is_a?(Array) - self.custom_ranking = value - end - end - if attributes.key?(:relevancy_strictness) self.relevancy_strictness = attributes[:relevancy_strictness] end @@ -615,10 +734,6 @@ def initialize(attributes = {}) self.restrict_highlight_and_snippet_arrays = attributes[:restrict_highlight_and_snippet_arrays] end - if attributes.key?(:hits_per_page) - self.hits_per_page = attributes[:hits_per_page] - end - if attributes.key?(:min_word_sizefor1_typo) self.min_word_sizefor1_typo = attributes[:min_word_sizefor1_typo] end @@ -649,10 +764,6 @@ def initialize(attributes = {}) self.remove_stop_words = attributes[:remove_stop_words] end - if attributes.key?(:keep_diacritics_on_characters) - self.keep_diacritics_on_characters = attributes[:keep_diacritics_on_characters] - end - if attributes.key?(:query_languages) if (value = attributes[:query_languages]).is_a?(Array) self.query_languages = value @@ -679,14 +790,6 @@ def initialize(attributes = {}) self.remove_words_if_no_results = attributes[:remove_words_if_no_results] end - if attributes.key?(:mode) - self.mode = attributes[:mode] - end - - if attributes.key?(:semantic_search) - self.semantic_search = attributes[:semantic_search] - end - if attributes.key?(:advanced_syntax) self.advanced_syntax = attributes[:advanced_syntax] end @@ -766,38 +869,6 @@ def initialize(attributes = {}) end end - # Custom attribute writer method with validation - # @param [Object] page Value to be assigned - def page=(page) - if page.nil? - raise ArgumentError, "page cannot be nil" - end - - if page < 0 - raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." - end - - @page = page - end - - # Custom attribute writer method with validation - # @param [Object] length Value to be assigned - def length=(length) - if length.nil? - raise ArgumentError, "length cannot be nil" - end - - if length > 1000 - raise ArgumentError, "invalid value for \"length\", must be smaller than or equal to 1000." - end - - if length < 0 - raise ArgumentError, "invalid value for \"length\", must be greater than or equal to 0." - end - - @length = length - end - # Custom attribute writer method with validation # @param [Object] minimum_around_radius Value to be assigned def minimum_around_radius=(minimum_around_radius) @@ -831,21 +902,17 @@ def personalization_impact=(personalization_impact) end # Custom attribute writer method with validation - # @param [Object] hits_per_page Value to be assigned - def hits_per_page=(hits_per_page) - if hits_per_page.nil? - raise ArgumentError, "hits_per_page cannot be nil" - end - - if hits_per_page > 1000 - raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000." + # @param [Object] pagination_limited_to Value to be assigned + def pagination_limited_to=(pagination_limited_to) + if pagination_limited_to.nil? + raise ArgumentError, "pagination_limited_to cannot be nil" end - if hits_per_page < 1 - raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1." + if pagination_limited_to > 20000 + raise ArgumentError, "invalid value for \"pagination_limited_to\", must be smaller than or equal to 20000." end - @hits_per_page = hits_per_page + @pagination_limited_to = pagination_limited_to end # Custom attribute writer method with validation @@ -899,7 +966,6 @@ def max_values_per_facet=(max_values_per_facet) def ==(other) return true if self.equal?(other) self.class == other.class && - query == other.query && similar_query == other.similar_query && filters == other.filters && facet_filters == other.facet_filters && @@ -910,9 +976,6 @@ def ==(other) restrict_searchable_attributes == other.restrict_searchable_attributes && facets == other.facets && faceting_after_distinct == other.faceting_after_distinct && - page == other.page && - offset == other.offset && - length == other.length && around_lat_lng == other.around_lat_lng && around_lat_lng_via_ip == other.around_lat_lng_via_ip && around_radius == other.around_radius && @@ -931,9 +994,26 @@ def ==(other) analytics_tags == other.analytics_tags && percentile_computation == other.percentile_computation && enable_ab_test == other.enable_ab_test && + query == other.query && + attributes_for_faceting == other.attributes_for_faceting && + replicas == other.replicas && + pagination_limited_to == other.pagination_limited_to && + unretrievable_attributes == other.unretrievable_attributes && + disable_typo_tolerance_on_words == other.disable_typo_tolerance_on_words && + attributes_to_transliterate == other.attributes_to_transliterate && + camel_case_attributes == other.camel_case_attributes && + decompounded_attributes == other.decompounded_attributes && + index_languages == other.index_languages && + disable_prefix_on_attributes == other.disable_prefix_on_attributes && + allow_compression_of_integer_array == other.allow_compression_of_integer_array && + numeric_attributes_for_filtering == other.numeric_attributes_for_filtering && + separators_to_index == other.separators_to_index && + searchable_attributes == other.searchable_attributes && + user_data == other.user_data && + custom_normalization == other.custom_normalization && + attribute_for_distinct == other.attribute_for_distinct && attributes_to_retrieve == other.attributes_to_retrieve && ranking == other.ranking && - custom_ranking == other.custom_ranking && relevancy_strictness == other.relevancy_strictness && attributes_to_highlight == other.attributes_to_highlight && attributes_to_snippet == other.attributes_to_snippet && @@ -941,7 +1021,6 @@ def ==(other) highlight_post_tag == other.highlight_post_tag && snippet_ellipsis_text == other.snippet_ellipsis_text && restrict_highlight_and_snippet_arrays == other.restrict_highlight_and_snippet_arrays && - hits_per_page == other.hits_per_page && min_word_sizefor1_typo == other.min_word_sizefor1_typo && min_word_sizefor2_typos == other.min_word_sizefor2_typos && typo_tolerance == other.typo_tolerance && @@ -949,15 +1028,12 @@ def ==(other) disable_typo_tolerance_on_attributes == other.disable_typo_tolerance_on_attributes && ignore_plurals == other.ignore_plurals && remove_stop_words == other.remove_stop_words && - keep_diacritics_on_characters == other.keep_diacritics_on_characters && query_languages == other.query_languages && decompound_query == other.decompound_query && enable_rules == other.enable_rules && enable_personalization == other.enable_personalization && query_type == other.query_type && remove_words_if_no_results == other.remove_words_if_no_results && - mode == other.mode && - semantic_search == other.semantic_search && advanced_syntax == other.advanced_syntax && optional_words == other.optional_words && disable_exact_on_attributes == other.disable_exact_on_attributes && @@ -987,7 +1063,6 @@ def eql?(other) # @return [Integer] Hash code def hash [ - query, similar_query, filters, facet_filters, @@ -998,9 +1073,6 @@ def hash restrict_searchable_attributes, facets, faceting_after_distinct, - page, - offset, - length, around_lat_lng, around_lat_lng_via_ip, around_radius, @@ -1019,9 +1091,26 @@ def hash analytics_tags, percentile_computation, enable_ab_test, + query, + attributes_for_faceting, + replicas, + pagination_limited_to, + unretrievable_attributes, + disable_typo_tolerance_on_words, + attributes_to_transliterate, + camel_case_attributes, + decompounded_attributes, + index_languages, + disable_prefix_on_attributes, + allow_compression_of_integer_array, + numeric_attributes_for_filtering, + separators_to_index, + searchable_attributes, + user_data, + custom_normalization, + attribute_for_distinct, attributes_to_retrieve, ranking, - custom_ranking, relevancy_strictness, attributes_to_highlight, attributes_to_snippet, @@ -1029,7 +1118,6 @@ def hash highlight_post_tag, snippet_ellipsis_text, restrict_highlight_and_snippet_arrays, - hits_per_page, min_word_sizefor1_typo, min_word_sizefor2_typos, typo_tolerance, @@ -1037,15 +1125,12 @@ def hash disable_typo_tolerance_on_attributes, ignore_plurals, remove_stop_words, - keep_diacritics_on_characters, query_languages, decompound_query, enable_rules, enable_personalization, query_type, remove_words_if_no_results, - mode, - semantic_search, advanced_syntax, optional_words, disable_exact_on_attributes, diff --git a/lib/algolia/models/recommend/facets.rb b/lib/algolia/models/recommend/index_settings_facets.rb similarity index 94% rename from lib/algolia/models/recommend/facets.rb rename to lib/algolia/models/recommend/index_settings_facets.rb index 54a60576..ef78f044 100644 --- a/lib/algolia/models/recommend/facets.rb +++ b/lib/algolia/models/recommend/index_settings_facets.rb @@ -6,7 +6,7 @@ module Algolia module Recommend # Order of facet names. - class Facets + class IndexSettingsFacets # Explicit order of facets or facet values. This setting lets you always show specific facets or facet values at the top of the list. attr_accessor :order @@ -40,7 +40,10 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::Facets` initialize method" + raise( + ArgumentError, + "The input argument (attributes) must be a hash in `Algolia::IndexSettingsFacets` initialize method" + ) end # check to see if the attribute exists and convert string to symbol for hash key @@ -48,7 +51,7 @@ def initialize(attributes = {}) if (!self.class.attribute_map.key?(k.to_sym)) raise( ArgumentError, - "`#{k}` is not a valid attribute in `Algolia::Facets`. Please check the name to make sure it's valid. List of attributes: " + + "`#{k}` is not a valid attribute in `Algolia::IndexSettingsFacets`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect ) end diff --git a/lib/algolia/models/recommend/looking_similar_query.rb b/lib/algolia/models/recommend/looking_similar_query.rb index 2dc1a5c9..5ed0dc91 100644 --- a/lib/algolia/models/recommend/looking_similar_query.rb +++ b/lib/algolia/models/recommend/looking_similar_query.rb @@ -48,7 +48,7 @@ def self.types_mapping :index_name => :"String", :threshold => :"Float", :max_recommendations => :"Integer", - :query_parameters => :"SearchParams", + :query_parameters => :"RecommendSearchParams", :model => :"LookingSimilarModel", :object_id => :"String", :fallback_parameters => :"FallbackParams" diff --git a/lib/algolia/models/recommend/mode.rb b/lib/algolia/models/recommend/mode.rb deleted file mode 100644 index 6d0cec57..00000000 --- a/lib/algolia/models/recommend/mode.rb +++ /dev/null @@ -1,32 +0,0 @@ -# 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 - class Mode - NEURAL_SEARCH = "neuralSearch".freeze - KEYWORD_SEARCH = "keywordSearch".freeze - - def self.all_vars - @all_vars ||= [NEURAL_SEARCH, KEYWORD_SEARCH].freeze - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - return value if Mode.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #Mode" - end - end - end -end diff --git a/lib/algolia/models/recommend/search_params.rb b/lib/algolia/models/recommend/recommend_search_params.rb similarity index 76% rename from lib/algolia/models/recommend/search_params.rb rename to lib/algolia/models/recommend/recommend_search_params.rb index 208dd847..cdbe2382 100644 --- a/lib/algolia/models/recommend/search_params.rb +++ b/lib/algolia/models/recommend/recommend_search_params.rb @@ -5,10 +5,8 @@ module Algolia module Recommend - class SearchParams - # Search query. - attr_accessor :query - + # Search parameters for filtering the recommendations. + class RecommendSearchParams # Keywords to be used instead of the search query to conduct a more broader search. Using the `similarQuery` parameter changes other settings: - `queryType` is set to `prefixNone`. - `removeStopWords` is set to true. - `words` is set as the first ranking criterion. - All remaining words are treated as `optionalWords`. Since the `similarQuery` is supposed to do a broad search, they usually return many results. Combine it with `filters` to narrow down the list of results. attr_accessor :similar_query @@ -35,15 +33,6 @@ class SearchParams # Whether faceting should be applied after deduplication with `distinct`. This leads to accurate facet counts when using faceting in combination with `distinct`. It's usually better to use `afterDistinct` modifiers in the `attributesForFaceting` setting, as `facetingAfterDistinct` only computes correct facet counts if all records have the same facet values for the `attributeForDistinct`. attr_accessor :faceting_after_distinct - # Page of search results to retrieve. - attr_accessor :page - - # Position of the first hit to retrieve. - attr_accessor :offset - - # Number of hits to retrieve (used in combination with `offset`). - attr_accessor :length - # Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude. Only records included within circle around this central location are included in the results. The radius of the circle is determined by the `aroundRadius` and `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` or `insideBoundingBox`. attr_accessor :around_lat_lng @@ -96,15 +85,66 @@ class SearchParams # Whether to enable A/B testing for this search. attr_accessor :enable_ab_test + # Search query. + attr_accessor :query + + # Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/). Facets are attributes that let you categorize search results. They can be used for filtering search results. By default, no attribute is used for faceting. Attribute names are case-sensitive. **Modifiers** - `filterOnly(\"ATTRIBUTE\")`. Allows using this attribute as a filter, but doesn't evalue the facet values. - `searchable(\"ATTRIBUTE\")`. Allows searching for facet values. - `afterDistinct(\"ATTRIBUTE\")`. Evaluates the facet count _after_ deduplication with `distinct`. This ensures accurate facet counts. You can apply this modifier to searchable facets: `afterDistinct(searchable(ATTRIBUTE))`. + attr_accessor :attributes_for_faceting + + # Creates [replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/). Replicas are copies of a primary index with the same records but different settings, synonyms, or rules. If you want to offer a different ranking or sorting of your search results, you'll use replica indices. All index operations on a primary index are automatically forwarded to its replicas. To add a replica index, you must provide the complete set of replicas to this parameter. If you omit a replica from this list, the replica turns into a regular, standalone index that will no longer by synced with the primary index. **Modifier** - `virtual(\"REPLICA\")`. Create a virtual replica, Virtual replicas don't increase the number of records and are optimized for [Relevant sorting](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/relevant-sort/). + attr_accessor :replicas + + # Maximum number of search results that can be obtained through pagination. Higher pagination limits might slow down your search. For pagination limits above 1,000, the sorting of results beyond the 1,000th hit can't be guaranteed. + attr_accessor :pagination_limited_to + + # Attributes that can't be retrieved at query time. This can be useful if you want to use an attribute for ranking or to [restrict access](https://www.algolia.com/doc/guides/security/api-keys/how-to/user-restricted-access-to-data/), but don't want to include it in the search results. Attribute names are case-sensitive. + attr_accessor :unretrievable_attributes + + # Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). This also turns off [word splitting and concatenation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/splitting-and-concatenation/) for the specified words. + attr_accessor :disable_typo_tolerance_on_words + + # Attributes, for which you want to support [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead). Transliteration supports searching in any of the Japanese writing systems. To support transliteration, you must set the indexing language to Japanese. Attribute names are case-sensitive. + attr_accessor :attributes_to_transliterate + + # Attributes for which to split [camel case](https://wikipedia.org/wiki/Camel_case) words. Attribute names are case-sensitive. + attr_accessor :camel_case_attributes + + # Searchable attributes to which Algolia should apply [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding). Attribute names are case-sensitive. Compound words are formed by combining two or more individual words, and are particularly prevalent in Germanic languages—for example, \"firefighter\". With decompounding, the individual components are indexed separately. You can specify different lists for different languages. Decompounding is supported for these languages: Dutch (`nl`), German (`de`), Finnish (`fi`), Danish (`da`), Swedish (`sv`), and Norwegian (`no`). Decompounding doesn't work for words with [non-spacing mark Unicode characters](https://www.charactercodes.net/category/non-spacing_mark). For example, `Gartenstühle` won't be decompounded if the `ü` consists of `u` (U+0075) and `◌̈` (U+0308). + attr_accessor :decompounded_attributes + + # Languages for language-specific processing steps, such as word detection and dictionary settings. **You should always specify an indexing language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/). + attr_accessor :index_languages + + # Searchable attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search). Attribute names are case-sensitive. + attr_accessor :disable_prefix_on_attributes + + # Whether arrays with exclusively non-negative integers should be compressed for better performance. If true, the compressed arrays may be reordered. + attr_accessor :allow_compression_of_integer_array + + # Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters). Attribute names are case-sensitive. By default, all numeric attributes are available as numerical filters. For faster indexing, reduce the number of numeric attributes. If you want to turn off filtering for all numeric attributes, specifiy an attribute that doesn't exist in your index, such as `NO_NUMERIC_FILTERING`. **Modifier** - `equalOnly(\"ATTRIBUTE\")`. Support only filtering based on equality comparisons `=` and `!=`. + attr_accessor :numeric_attributes_for_filtering + + # Controls which separators are indexed. Separators are all non-letter characters except spaces and currency characters, such as $€£¥. By default, separator characters aren't indexed. With `separatorsToIndex`, Algolia treats separator characters as separate words. For example, a search for `C#` would report two matches. + attr_accessor :separators_to_index + + # Attributes used for searching. Attribute names are case-sensitive. By default, all attributes are searchable and the [Attribute](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute) ranking criterion is turned off. With a non-empty list, Algolia only returns results with matches in the selected attributes. In addition, the Attribute ranking criterion is turned on: matches in attributes that are higher in the list of `searchableAttributes` rank first. To make matches in two attributes rank equally, include them in a comma-separated string, such as `\"title,alternate_title\"`. Attributes with the same priority are always unordered. For more information, see [Searchable attributes](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/setting-searchable-attributes/). **Modifier** - `unordered(\"ATTRIBUTE\")`. Ignore the position of a match within the attribute. Without modifier, matches at the beginning of an attribute rank higer than matches at the end. + attr_accessor :searchable_attributes + + # An object with custom data. You can store up to 32kB as custom data. + attr_accessor :user_data + + # Characters and their normalized replacements. This overrides Algolia's default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + attr_accessor :custom_normalization + + # 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 + # 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 # Determines the order in which Algolia returns your results. By default, each entry corresponds to a [ranking criteria](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). The tie-breaking algorithm sequentially applies each criterion in the order they're specified. If you configure a replica index for [sorting by an attribute](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-by-attribute/), you put the sorting attribute at the top of the list. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. Before you modify the default setting, you should test your changes in the dashboard, and by [A/B testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/). attr_accessor :ranking - # Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied. - attr_accessor :custom_ranking - # Relevancy threshold below which less relevant results aren't included in the results. You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results. attr_accessor :relevancy_strictness @@ -126,9 +166,6 @@ class SearchParams # Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted. attr_accessor :restrict_highlight_and_snippet_arrays - # Number of hits per page. - attr_accessor :hits_per_page - # Minimum number of characters a word in the search query must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). attr_accessor :min_word_sizefor1_typo @@ -147,9 +184,6 @@ class SearchParams attr_accessor :remove_stop_words - # Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics. - attr_accessor :keep_diacritics_on_characters - # Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries. This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first**. **You should always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/). attr_accessor :query_languages @@ -166,10 +200,6 @@ class SearchParams attr_accessor :remove_words_if_no_results - attr_accessor :mode - - attr_accessor :semantic_search - # 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 @@ -220,7 +250,6 @@ class SearchParams # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :query => :query, :similar_query => :similarQuery, :filters => :filters, :facet_filters => :facetFilters, @@ -231,9 +260,6 @@ def self.attribute_map :restrict_searchable_attributes => :restrictSearchableAttributes, :facets => :facets, :faceting_after_distinct => :facetingAfterDistinct, - :page => :page, - :offset => :offset, - :length => :length, :around_lat_lng => :aroundLatLng, :around_lat_lng_via_ip => :aroundLatLngViaIP, :around_radius => :aroundRadius, @@ -252,9 +278,26 @@ def self.attribute_map :analytics_tags => :analyticsTags, :percentile_computation => :percentileComputation, :enable_ab_test => :enableABTest, + :query => :query, + :attributes_for_faceting => :attributesForFaceting, + :replicas => :replicas, + :pagination_limited_to => :paginationLimitedTo, + :unretrievable_attributes => :unretrievableAttributes, + :disable_typo_tolerance_on_words => :disableTypoToleranceOnWords, + :attributes_to_transliterate => :attributesToTransliterate, + :camel_case_attributes => :camelCaseAttributes, + :decompounded_attributes => :decompoundedAttributes, + :index_languages => :indexLanguages, + :disable_prefix_on_attributes => :disablePrefixOnAttributes, + :allow_compression_of_integer_array => :allowCompressionOfIntegerArray, + :numeric_attributes_for_filtering => :numericAttributesForFiltering, + :separators_to_index => :separatorsToIndex, + :searchable_attributes => :searchableAttributes, + :user_data => :userData, + :custom_normalization => :customNormalization, + :attribute_for_distinct => :attributeForDistinct, :attributes_to_retrieve => :attributesToRetrieve, :ranking => :ranking, - :custom_ranking => :customRanking, :relevancy_strictness => :relevancyStrictness, :attributes_to_highlight => :attributesToHighlight, :attributes_to_snippet => :attributesToSnippet, @@ -262,7 +305,6 @@ def self.attribute_map :highlight_post_tag => :highlightPostTag, :snippet_ellipsis_text => :snippetEllipsisText, :restrict_highlight_and_snippet_arrays => :restrictHighlightAndSnippetArrays, - :hits_per_page => :hitsPerPage, :min_word_sizefor1_typo => :minWordSizefor1Typo, :min_word_sizefor2_typos => :minWordSizefor2Typos, :typo_tolerance => :typoTolerance, @@ -270,15 +312,12 @@ def self.attribute_map :disable_typo_tolerance_on_attributes => :disableTypoToleranceOnAttributes, :ignore_plurals => :ignorePlurals, :remove_stop_words => :removeStopWords, - :keep_diacritics_on_characters => :keepDiacriticsOnCharacters, :query_languages => :queryLanguages, :decompound_query => :decompoundQuery, :enable_rules => :enableRules, :enable_personalization => :enablePersonalization, :query_type => :queryType, :remove_words_if_no_results => :removeWordsIfNoResults, - :mode => :mode, - :semantic_search => :semanticSearch, :advanced_syntax => :advancedSyntax, :optional_words => :optionalWords, :disable_exact_on_attributes => :disableExactOnAttributes, @@ -307,7 +346,6 @@ def self.acceptable_attributes # Attribute type mapping. def self.types_mapping { - :query => :"String", :similar_query => :"String", :filters => :"String", :facet_filters => :"FacetFilters", @@ -318,9 +356,6 @@ def self.types_mapping :restrict_searchable_attributes => :"Array", :facets => :"Array", :faceting_after_distinct => :"Boolean", - :page => :"Integer", - :offset => :"Integer", - :length => :"Integer", :around_lat_lng => :"String", :around_lat_lng_via_ip => :"Boolean", :around_radius => :"AroundRadius", @@ -339,9 +374,26 @@ def self.types_mapping :analytics_tags => :"Array", :percentile_computation => :"Boolean", :enable_ab_test => :"Boolean", + :query => :"String", + :attributes_for_faceting => :"Array", + :replicas => :"Array", + :pagination_limited_to => :"Integer", + :unretrievable_attributes => :"Array", + :disable_typo_tolerance_on_words => :"Array", + :attributes_to_transliterate => :"Array", + :camel_case_attributes => :"Array", + :decompounded_attributes => :"Object", + :index_languages => :"Array", + :disable_prefix_on_attributes => :"Array", + :allow_compression_of_integer_array => :"Boolean", + :numeric_attributes_for_filtering => :"Array", + :separators_to_index => :"String", + :searchable_attributes => :"Array", + :user_data => :"Object", + :custom_normalization => :"Hash>", + :attribute_for_distinct => :"String", :attributes_to_retrieve => :"Array", :ranking => :"Array", - :custom_ranking => :"Array", :relevancy_strictness => :"Integer", :attributes_to_highlight => :"Array", :attributes_to_snippet => :"Array", @@ -349,7 +401,6 @@ def self.types_mapping :highlight_post_tag => :"String", :snippet_ellipsis_text => :"String", :restrict_highlight_and_snippet_arrays => :"Boolean", - :hits_per_page => :"Integer", :min_word_sizefor1_typo => :"Integer", :min_word_sizefor2_typos => :"Integer", :typo_tolerance => :"TypoTolerance", @@ -357,15 +408,12 @@ def self.types_mapping :disable_typo_tolerance_on_attributes => :"Array", :ignore_plurals => :"IgnorePlurals", :remove_stop_words => :"RemoveStopWords", - :keep_diacritics_on_characters => :"String", :query_languages => :"Array", :decompound_query => :"Boolean", :enable_rules => :"Boolean", :enable_personalization => :"Boolean", :query_type => :"QueryType", :remove_words_if_no_results => :"RemoveWordsIfNoResults", - :mode => :"Mode", - :semantic_search => :"SemanticSearch", :advanced_syntax => :"Boolean", :optional_words => :"Array", :disable_exact_on_attributes => :"Array", @@ -396,7 +444,9 @@ def self.openapi_nullable # List of class defined in allOf (OpenAPI v3) def self.openapi_all_of [ - :"SearchParamsObject" + :"BaseRecommendSearchParams", + :"RecommendIndexSettings", + :"SearchParamsQuery" ] end @@ -406,7 +456,7 @@ def initialize(attributes = {}) if (!attributes.is_a?(Hash)) raise( ArgumentError, - "The input argument (attributes) must be a hash in `Algolia::SearchParams` initialize method" + "The input argument (attributes) must be a hash in `Algolia::RecommendSearchParams` initialize method" ) end @@ -415,7 +465,7 @@ def initialize(attributes = {}) if (!self.class.attribute_map.key?(k.to_sym)) raise( ArgumentError, - "`#{k}` is not a valid attribute in `Algolia::SearchParams`. Please check the name to make sure it's valid. List of attributes: " + + "`#{k}` is not a valid attribute in `Algolia::RecommendSearchParams`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect ) end @@ -423,10 +473,6 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:query) - self.query = attributes[:query] - end - if attributes.key?(:similar_query) self.similar_query = attributes[:similar_query] end @@ -471,18 +517,6 @@ def initialize(attributes = {}) self.faceting_after_distinct = attributes[:faceting_after_distinct] end - if attributes.key?(:page) - self.page = attributes[:page] - end - - if attributes.key?(:offset) - self.offset = attributes[:offset] - end - - if attributes.key?(:length) - self.length = attributes[:length] - end - if attributes.key?(:around_lat_lng) self.around_lat_lng = attributes[:around_lat_lng] end @@ -565,6 +599,100 @@ def initialize(attributes = {}) self.enable_ab_test = attributes[:enable_ab_test] end + if attributes.key?(:query) + self.query = attributes[:query] + end + + if attributes.key?(:attributes_for_faceting) + if (value = attributes[:attributes_for_faceting]).is_a?(Array) + self.attributes_for_faceting = value + end + end + + if attributes.key?(:replicas) + if (value = attributes[:replicas]).is_a?(Array) + self.replicas = value + end + end + + if attributes.key?(:pagination_limited_to) + self.pagination_limited_to = attributes[:pagination_limited_to] + end + + if attributes.key?(:unretrievable_attributes) + if (value = attributes[:unretrievable_attributes]).is_a?(Array) + self.unretrievable_attributes = value + end + end + + if attributes.key?(:disable_typo_tolerance_on_words) + if (value = attributes[:disable_typo_tolerance_on_words]).is_a?(Array) + self.disable_typo_tolerance_on_words = value + end + end + + if attributes.key?(:attributes_to_transliterate) + if (value = attributes[:attributes_to_transliterate]).is_a?(Array) + self.attributes_to_transliterate = value + end + end + + if attributes.key?(:camel_case_attributes) + if (value = attributes[:camel_case_attributes]).is_a?(Array) + self.camel_case_attributes = value + end + end + + if attributes.key?(:decompounded_attributes) + self.decompounded_attributes = attributes[:decompounded_attributes] + end + + if attributes.key?(:index_languages) + if (value = attributes[:index_languages]).is_a?(Array) + self.index_languages = value + end + end + + if attributes.key?(:disable_prefix_on_attributes) + if (value = attributes[:disable_prefix_on_attributes]).is_a?(Array) + self.disable_prefix_on_attributes = value + end + end + + if attributes.key?(:allow_compression_of_integer_array) + self.allow_compression_of_integer_array = attributes[:allow_compression_of_integer_array] + end + + if attributes.key?(:numeric_attributes_for_filtering) + if (value = attributes[:numeric_attributes_for_filtering]).is_a?(Array) + self.numeric_attributes_for_filtering = value + end + end + + if attributes.key?(:separators_to_index) + self.separators_to_index = attributes[:separators_to_index] + end + + if attributes.key?(:searchable_attributes) + if (value = attributes[:searchable_attributes]).is_a?(Array) + self.searchable_attributes = value + end + end + + if attributes.key?(:user_data) + self.user_data = attributes[:user_data] + end + + if attributes.key?(:custom_normalization) + if (value = attributes[:custom_normalization]).is_a?(Hash) + self.custom_normalization = value + end + end + + if attributes.key?(:attribute_for_distinct) + self.attribute_for_distinct = attributes[:attribute_for_distinct] + end + if attributes.key?(:attributes_to_retrieve) if (value = attributes[:attributes_to_retrieve]).is_a?(Array) self.attributes_to_retrieve = value @@ -577,12 +705,6 @@ def initialize(attributes = {}) end end - if attributes.key?(:custom_ranking) - if (value = attributes[:custom_ranking]).is_a?(Array) - self.custom_ranking = value - end - end - if attributes.key?(:relevancy_strictness) self.relevancy_strictness = attributes[:relevancy_strictness] end @@ -615,10 +737,6 @@ def initialize(attributes = {}) self.restrict_highlight_and_snippet_arrays = attributes[:restrict_highlight_and_snippet_arrays] end - if attributes.key?(:hits_per_page) - self.hits_per_page = attributes[:hits_per_page] - end - if attributes.key?(:min_word_sizefor1_typo) self.min_word_sizefor1_typo = attributes[:min_word_sizefor1_typo] end @@ -649,10 +767,6 @@ def initialize(attributes = {}) self.remove_stop_words = attributes[:remove_stop_words] end - if attributes.key?(:keep_diacritics_on_characters) - self.keep_diacritics_on_characters = attributes[:keep_diacritics_on_characters] - end - if attributes.key?(:query_languages) if (value = attributes[:query_languages]).is_a?(Array) self.query_languages = value @@ -679,14 +793,6 @@ def initialize(attributes = {}) self.remove_words_if_no_results = attributes[:remove_words_if_no_results] end - if attributes.key?(:mode) - self.mode = attributes[:mode] - end - - if attributes.key?(:semantic_search) - self.semantic_search = attributes[:semantic_search] - end - if attributes.key?(:advanced_syntax) self.advanced_syntax = attributes[:advanced_syntax] end @@ -766,38 +872,6 @@ def initialize(attributes = {}) end end - # Custom attribute writer method with validation - # @param [Object] page Value to be assigned - def page=(page) - if page.nil? - raise ArgumentError, "page cannot be nil" - end - - if page < 0 - raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." - end - - @page = page - end - - # Custom attribute writer method with validation - # @param [Object] length Value to be assigned - def length=(length) - if length.nil? - raise ArgumentError, "length cannot be nil" - end - - if length > 1000 - raise ArgumentError, "invalid value for \"length\", must be smaller than or equal to 1000." - end - - if length < 0 - raise ArgumentError, "invalid value for \"length\", must be greater than or equal to 0." - end - - @length = length - end - # Custom attribute writer method with validation # @param [Object] minimum_around_radius Value to be assigned def minimum_around_radius=(minimum_around_radius) @@ -831,21 +905,17 @@ def personalization_impact=(personalization_impact) end # Custom attribute writer method with validation - # @param [Object] hits_per_page Value to be assigned - def hits_per_page=(hits_per_page) - if hits_per_page.nil? - raise ArgumentError, "hits_per_page cannot be nil" - end - - if hits_per_page > 1000 - raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000." + # @param [Object] pagination_limited_to Value to be assigned + def pagination_limited_to=(pagination_limited_to) + if pagination_limited_to.nil? + raise ArgumentError, "pagination_limited_to cannot be nil" end - if hits_per_page < 1 - raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1." + if pagination_limited_to > 20000 + raise ArgumentError, "invalid value for \"pagination_limited_to\", must be smaller than or equal to 20000." end - @hits_per_page = hits_per_page + @pagination_limited_to = pagination_limited_to end # Custom attribute writer method with validation @@ -899,7 +969,6 @@ def max_values_per_facet=(max_values_per_facet) def ==(other) return true if self.equal?(other) self.class == other.class && - query == other.query && similar_query == other.similar_query && filters == other.filters && facet_filters == other.facet_filters && @@ -910,9 +979,6 @@ def ==(other) restrict_searchable_attributes == other.restrict_searchable_attributes && facets == other.facets && faceting_after_distinct == other.faceting_after_distinct && - page == other.page && - offset == other.offset && - length == other.length && around_lat_lng == other.around_lat_lng && around_lat_lng_via_ip == other.around_lat_lng_via_ip && around_radius == other.around_radius && @@ -931,9 +997,26 @@ def ==(other) analytics_tags == other.analytics_tags && percentile_computation == other.percentile_computation && enable_ab_test == other.enable_ab_test && + query == other.query && + attributes_for_faceting == other.attributes_for_faceting && + replicas == other.replicas && + pagination_limited_to == other.pagination_limited_to && + unretrievable_attributes == other.unretrievable_attributes && + disable_typo_tolerance_on_words == other.disable_typo_tolerance_on_words && + attributes_to_transliterate == other.attributes_to_transliterate && + camel_case_attributes == other.camel_case_attributes && + decompounded_attributes == other.decompounded_attributes && + index_languages == other.index_languages && + disable_prefix_on_attributes == other.disable_prefix_on_attributes && + allow_compression_of_integer_array == other.allow_compression_of_integer_array && + numeric_attributes_for_filtering == other.numeric_attributes_for_filtering && + separators_to_index == other.separators_to_index && + searchable_attributes == other.searchable_attributes && + user_data == other.user_data && + custom_normalization == other.custom_normalization && + attribute_for_distinct == other.attribute_for_distinct && attributes_to_retrieve == other.attributes_to_retrieve && ranking == other.ranking && - custom_ranking == other.custom_ranking && relevancy_strictness == other.relevancy_strictness && attributes_to_highlight == other.attributes_to_highlight && attributes_to_snippet == other.attributes_to_snippet && @@ -941,7 +1024,6 @@ def ==(other) highlight_post_tag == other.highlight_post_tag && snippet_ellipsis_text == other.snippet_ellipsis_text && restrict_highlight_and_snippet_arrays == other.restrict_highlight_and_snippet_arrays && - hits_per_page == other.hits_per_page && min_word_sizefor1_typo == other.min_word_sizefor1_typo && min_word_sizefor2_typos == other.min_word_sizefor2_typos && typo_tolerance == other.typo_tolerance && @@ -949,15 +1031,12 @@ def ==(other) disable_typo_tolerance_on_attributes == other.disable_typo_tolerance_on_attributes && ignore_plurals == other.ignore_plurals && remove_stop_words == other.remove_stop_words && - keep_diacritics_on_characters == other.keep_diacritics_on_characters && query_languages == other.query_languages && decompound_query == other.decompound_query && enable_rules == other.enable_rules && enable_personalization == other.enable_personalization && query_type == other.query_type && remove_words_if_no_results == other.remove_words_if_no_results && - mode == other.mode && - semantic_search == other.semantic_search && advanced_syntax == other.advanced_syntax && optional_words == other.optional_words && disable_exact_on_attributes == other.disable_exact_on_attributes && @@ -987,7 +1066,6 @@ def eql?(other) # @return [Integer] Hash code def hash [ - query, similar_query, filters, facet_filters, @@ -998,9 +1076,6 @@ def hash restrict_searchable_attributes, facets, faceting_after_distinct, - page, - offset, - length, around_lat_lng, around_lat_lng_via_ip, around_radius, @@ -1019,9 +1094,26 @@ def hash analytics_tags, percentile_computation, enable_ab_test, + query, + attributes_for_faceting, + replicas, + pagination_limited_to, + unretrievable_attributes, + disable_typo_tolerance_on_words, + attributes_to_transliterate, + camel_case_attributes, + decompounded_attributes, + index_languages, + disable_prefix_on_attributes, + allow_compression_of_integer_array, + numeric_attributes_for_filtering, + separators_to_index, + searchable_attributes, + user_data, + custom_normalization, + attribute_for_distinct, attributes_to_retrieve, ranking, - custom_ranking, relevancy_strictness, attributes_to_highlight, attributes_to_snippet, @@ -1029,7 +1121,6 @@ def hash highlight_post_tag, snippet_ellipsis_text, restrict_highlight_and_snippet_arrays, - hits_per_page, min_word_sizefor1_typo, min_word_sizefor2_typos, typo_tolerance, @@ -1037,15 +1128,12 @@ def hash disable_typo_tolerance_on_attributes, ignore_plurals, remove_stop_words, - keep_diacritics_on_characters, query_languages, decompound_query, enable_rules, enable_personalization, query_type, remove_words_if_no_results, - mode, - semantic_search, advanced_syntax, optional_words, disable_exact_on_attributes, diff --git a/lib/algolia/models/recommend/recommended_for_you_query.rb b/lib/algolia/models/recommend/recommended_for_you_query.rb index 44aa11a4..5091f44a 100644 --- a/lib/algolia/models/recommend/recommended_for_you_query.rb +++ b/lib/algolia/models/recommend/recommended_for_you_query.rb @@ -44,7 +44,7 @@ def self.types_mapping :index_name => :"String", :threshold => :"Float", :max_recommendations => :"Integer", - :query_parameters => :"SearchParams", + :query_parameters => :"RecommendSearchParams", :model => :"RecommendedForYouModel", :fallback_parameters => :"FallbackParams" } diff --git a/lib/algolia/models/recommend/related_query.rb b/lib/algolia/models/recommend/related_query.rb index 4871ab65..1ccbe316 100644 --- a/lib/algolia/models/recommend/related_query.rb +++ b/lib/algolia/models/recommend/related_query.rb @@ -48,7 +48,7 @@ def self.types_mapping :index_name => :"String", :threshold => :"Float", :max_recommendations => :"Integer", - :query_parameters => :"SearchParams", + :query_parameters => :"RecommendSearchParams", :model => :"RelatedModel", :object_id => :"String", :fallback_parameters => :"FallbackParams" diff --git a/lib/algolia/models/recommend/search_params_object.rb b/lib/algolia/models/recommend/search_params_object.rb deleted file mode 100644 index 94ddbb21..00000000 --- a/lib/algolia/models/recommend/search_params_object.rb +++ /dev/null @@ -1,1197 +0,0 @@ -# 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 - # Each parameter value, including the `query` must not be larger than 512 bytes. - class SearchParamsObject - # Search query. - attr_accessor :query - - # Keywords to be used instead of the search query to conduct a more broader search. Using the `similarQuery` parameter changes other settings: - `queryType` is set to `prefixNone`. - `removeStopWords` is set to true. - `words` is set as the first ranking criterion. - All remaining words are treated as `optionalWords`. Since the `similarQuery` is supposed to do a broad search, they usually return many results. Combine it with `filters` to narrow down the list of results. - attr_accessor :similar_query - - # Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** ` `, where `` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `: TO ` where `` and `` are the lower and upper limits of the range (inclusive). - **Facet filters.** `:` where `` is a facet attribute (case-sensitive) and `` a facet value. - **Tag filters.** `_tags:` or just `` (case-sensitive). - **Boolean filters.** `: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can't use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can't combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/). - attr_accessor :filters - - attr_accessor :facet_filters - - attr_accessor :optional_filters - - attr_accessor :numeric_filters - - attr_accessor :tag_filters - - # Whether to sum all filter scores. If true, all filter scores are summed. Otherwise, the maximum filter score is kept. For more information, see [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). - attr_accessor :sum_or_filters_scores - - # Restricts a search to a subset of your searchable attributes. Attribute names are case-sensitive. - attr_accessor :restrict_searchable_attributes - - # Facets for which to retrieve facet values that match the search criteria and the number of matching facet values. To retrieve all facets, use the wildcard character `*`. For more information, see [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts). - attr_accessor :facets - - # Whether faceting should be applied after deduplication with `distinct`. This leads to accurate facet counts when using faceting in combination with `distinct`. It's usually better to use `afterDistinct` modifiers in the `attributesForFaceting` setting, as `facetingAfterDistinct` only computes correct facet counts if all records have the same facet values for the `attributeForDistinct`. - attr_accessor :faceting_after_distinct - - # Page of search results to retrieve. - attr_accessor :page - - # Position of the first hit to retrieve. - attr_accessor :offset - - # Number of hits to retrieve (used in combination with `offset`). - attr_accessor :length - - # Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude. Only records included within circle around this central location are included in the results. The radius of the circle is determined by the `aroundRadius` and `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` or `insideBoundingBox`. - attr_accessor :around_lat_lng - - # Whether to obtain the coordinates from the request's IP address. - attr_accessor :around_lat_lng_via_ip - - attr_accessor :around_radius - - attr_accessor :around_precision - - # 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`. - attr_accessor :inside_polygon - - # ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches): - Sets `removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`. - attr_accessor :natural_languages - - # Assigns a rule context to the search query. [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules. - attr_accessor :rule_contexts - - # Impact that Personalization should have on this search. The higher this value is, the more Personalization determines the ranking compared to other factors. For more information, see [Understanding Personalization impact](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). - attr_accessor :personalization_impact - - # Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). - attr_accessor :user_token - - # Whether the search response should include detailed ranking information. - attr_accessor :get_ranking_info - - # Whether to take into account an index's synonyms for this search. - attr_accessor :synonyms - - # Whether to include a `queryID` attribute in the response. The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/guides/sending-events/getting-started/). - attr_accessor :click_analytics - - # Whether this search will be included in Analytics. - attr_accessor :analytics - - # Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). - attr_accessor :analytics_tags - - # Whether to include this search when calculating processing-time percentiles. - attr_accessor :percentile_computation - - # Whether to enable A/B testing for this search. - attr_accessor :enable_ab_test - - # 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 - - # Determines the order in which Algolia returns your results. By default, each entry corresponds to a [ranking criteria](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). The tie-breaking algorithm sequentially applies each criterion in the order they're specified. If you configure a replica index for [sorting by an attribute](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/sort-by-attribute/), you put the sorting attribute at the top of the list. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. Before you modify the default setting, you should test your changes in the dashboard, and by [A/B testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/). - attr_accessor :ranking - - # Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Attribute names are case-sensitive. The custom ranking attributes decide which items are shown first if the other ranking criteria are equal. Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order. **Modifiers** - `asc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in ascending order. - `desc(\"ATTRIBUTE\")`. Sort the index by the values of an attribute, in descending order. If you use two or more custom ranking attributes, [reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes, or the other attributes will never be applied. - attr_accessor :custom_ranking - - # Relevancy threshold below which less relevant results aren't included in the results. You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results. - attr_accessor :relevancy_strictness - - # Attributes to highlight. By default, all searchable attributes are highlighted. Use `*` to highlight all attributes or use an empty array `[]` to turn off highlighting. Attribute names are case-sensitive. With highlighting, strings that match the search query are surrounded by HTML tags defined by `highlightPreTag` and `highlightPostTag`. You can use this to visually highlight matching parts of a search query in your UI. For more information, see [Highlighting and snippeting](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/highlighting-snippeting/js/). - attr_accessor :attributes_to_highlight - - # Attributes for which to enable snippets. Attribute names are case-sensitive. Snippets provide additional context to matched words. If you enable snippets, they include 10 words, including the matched word. The matched word will also be wrapped by HTML tags for highlighting. You can adjust the number of words with the following notation: `ATTRIBUTE:NUMBER`, where `NUMBER` is the number of words to be extracted. - attr_accessor :attributes_to_snippet - - # HTML tag to insert before the highlighted parts in all highlighted results and snippets. - attr_accessor :highlight_pre_tag - - # HTML tag to insert after the highlighted parts in all highlighted results and snippets. - attr_accessor :highlight_post_tag - - # String used as an ellipsis indicator when a snippet is truncated. - attr_accessor :snippet_ellipsis_text - - # Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted. - attr_accessor :restrict_highlight_and_snippet_arrays - - # Number of hits per page. - attr_accessor :hits_per_page - - # Minimum number of characters a word in the search query must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). - attr_accessor :min_word_sizefor1_typo - - # Minimum number of characters a word in the search query must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). - attr_accessor :min_word_sizefor2_typos - - attr_accessor :typo_tolerance - - # Whether to allow typos on numbers in the search query. Turn off this setting to reduce the number of irrelevant matches when searching in large sets of similar numbers. - attr_accessor :allow_typos_on_numeric_tokens - - # Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). Attribute names are case-sensitive. Returning only exact matches can help when: - [Searching in hyphenated attributes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/how-to/how-to-search-in-hyphenated-attributes/). - Reducing the number of matches when you have too many. This can happen with attributes that are long blocks of text, such as product descriptions. Consider alternatives such as `disableTypoToleranceOnWords` or adding synonyms if your attributes have intentional unusual spellings that might look like typos. - attr_accessor :disable_typo_tolerance_on_attributes - - attr_accessor :ignore_plurals - - attr_accessor :remove_stop_words - - # Characters for which diacritics should be preserved. By default, Algolia removes diacritics from letters. For example, `é` becomes `e`. If this causes issues in your search, you can specify characters that should keep their diacritics. - attr_accessor :keep_diacritics_on_characters - - # Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries. This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first**. **You should always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/). - attr_accessor :query_languages - - # Whether to split compound words in the query into their building blocks. For more information, see [Word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words). Word segmentation is supported for these languages: German, Dutch, Finnish, Swedish, and Norwegian. Decompounding doesn't work for words with [non-spacing mark Unicode characters](https://www.charactercodes.net/category/non-spacing_mark). For example, `Gartenstühle` won't be decompounded if the `ü` consists of `u` (U+0075) and `◌̈` (U+0308). - attr_accessor :decompound_query - - # Whether to enable rules. - attr_accessor :enable_rules - - # Whether to enable Personalization. - attr_accessor :enable_personalization - - attr_accessor :query_type - - attr_accessor :remove_words_if_no_results - - attr_accessor :mode - - attr_accessor :semantic_search - - # 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 dividied by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - 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 likelyhood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. - attr_accessor :disable_exact_on_attributes - - attr_accessor :exact_on_single_word_query - - # Alternatives of query words that should be considered as exact matches by the Exact ranking criterion. - `ignorePlurals`. Plurals and similar declensions added by the `ignorePlurals` setting are considered exact matches. - `singleWordSynonym`. Single-word synonyms, such as \"NY/NYC\" are considered exact matches. - `multiWordsSynonym`. Multi-word synonyms, such as \"NY/New York\" are considered exact matches. - attr_accessor :alternatives_as_exact - - # Advanced search syntax features you want to support. - `exactPhrase`. Phrases in quotes must match exactly. For example, `sparkly blue \"iPhone case\"` only returns records with the exact string \"iPhone case\". - `excludeWords`. Query words prefixed with a `-` must not occur in a record. For example, `search -engine` matches records that contain \"search\" but not \"engine\". This setting only has an effect if `advancedSyntax` is true. - attr_accessor :advanced_syntax_features - - attr_accessor :distinct - - # Whether to replace a highlighted word with the matched synonym. By default, the original words are highlighted even if a synonym matches. For example, with `home` as a synonym for `house` and a search for `home`, records matching either \"home\" or \"house\" are included in the search results, and either \"home\" or \"house\" are highlighted. With `replaceSynonymsInHighlight` set to `true`, a search for `home` still matches the same records, but all occurences of \"house\" are replaced by \"home\" in the highlighted response. - attr_accessor :replace_synonyms_in_highlight - - # Minimum proximity score for two matching words. This adjusts the [Proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity) by equally scoring matches that are farther apart. For example, if `minProximity` is 2, neighboring matches and matches with one word between them would have the same score. - attr_accessor :min_proximity - - # 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 - - # Order in which to retrieve facet values. - `count`. Facet values are retrieved by decreasing count. The count is the number of matching records containing this facet value. - `alpha`. Retrieve facet values alphabetically. This setting doesn't influence how facet values are displayed in your UI (see `renderingContent`). For more information, see [facet value display](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/facet-display/js/). - attr_accessor :sort_facet_values_by - - # Whether the best matching attribute should be determined by minimum proximity. This setting only affects ranking if the Attribute ranking criterion comes before Proximity in the `ranking` setting. If true, the best matching attribute is selected based on the minimum proximity of multiple matches. Otherwise, the best matching attribute is determined by the order in the `searchableAttributes` setting. - attr_accessor :attribute_criteria_computed_by_min_proximity - - attr_accessor :rendering_content - - # Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard. - attr_accessor :enable_re_ranking - - attr_accessor :re_ranking_apply_filter - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :query => :query, - :similar_query => :similarQuery, - :filters => :filters, - :facet_filters => :facetFilters, - :optional_filters => :optionalFilters, - :numeric_filters => :numericFilters, - :tag_filters => :tagFilters, - :sum_or_filters_scores => :sumOrFiltersScores, - :restrict_searchable_attributes => :restrictSearchableAttributes, - :facets => :facets, - :faceting_after_distinct => :facetingAfterDistinct, - :page => :page, - :offset => :offset, - :length => :length, - :around_lat_lng => :aroundLatLng, - :around_lat_lng_via_ip => :aroundLatLngViaIP, - :around_radius => :aroundRadius, - :around_precision => :aroundPrecision, - :minimum_around_radius => :minimumAroundRadius, - :inside_bounding_box => :insideBoundingBox, - :inside_polygon => :insidePolygon, - :natural_languages => :naturalLanguages, - :rule_contexts => :ruleContexts, - :personalization_impact => :personalizationImpact, - :user_token => :userToken, - :get_ranking_info => :getRankingInfo, - :synonyms => :synonyms, - :click_analytics => :clickAnalytics, - :analytics => :analytics, - :analytics_tags => :analyticsTags, - :percentile_computation => :percentileComputation, - :enable_ab_test => :enableABTest, - :attributes_to_retrieve => :attributesToRetrieve, - :ranking => :ranking, - :custom_ranking => :customRanking, - :relevancy_strictness => :relevancyStrictness, - :attributes_to_highlight => :attributesToHighlight, - :attributes_to_snippet => :attributesToSnippet, - :highlight_pre_tag => :highlightPreTag, - :highlight_post_tag => :highlightPostTag, - :snippet_ellipsis_text => :snippetEllipsisText, - :restrict_highlight_and_snippet_arrays => :restrictHighlightAndSnippetArrays, - :hits_per_page => :hitsPerPage, - :min_word_sizefor1_typo => :minWordSizefor1Typo, - :min_word_sizefor2_typos => :minWordSizefor2Typos, - :typo_tolerance => :typoTolerance, - :allow_typos_on_numeric_tokens => :allowTyposOnNumericTokens, - :disable_typo_tolerance_on_attributes => :disableTypoToleranceOnAttributes, - :ignore_plurals => :ignorePlurals, - :remove_stop_words => :removeStopWords, - :keep_diacritics_on_characters => :keepDiacriticsOnCharacters, - :query_languages => :queryLanguages, - :decompound_query => :decompoundQuery, - :enable_rules => :enableRules, - :enable_personalization => :enablePersonalization, - :query_type => :queryType, - :remove_words_if_no_results => :removeWordsIfNoResults, - :mode => :mode, - :semantic_search => :semanticSearch, - :advanced_syntax => :advancedSyntax, - :optional_words => :optionalWords, - :disable_exact_on_attributes => :disableExactOnAttributes, - :exact_on_single_word_query => :exactOnSingleWordQuery, - :alternatives_as_exact => :alternativesAsExact, - :advanced_syntax_features => :advancedSyntaxFeatures, - :distinct => :distinct, - :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, - :rendering_content => :renderingContent, - :enable_re_ranking => :enableReRanking, - :re_ranking_apply_filter => :reRankingApplyFilter - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.types_mapping - { - :query => :"String", - :similar_query => :"String", - :filters => :"String", - :facet_filters => :"FacetFilters", - :optional_filters => :"OptionalFilters", - :numeric_filters => :"NumericFilters", - :tag_filters => :"TagFilters", - :sum_or_filters_scores => :"Boolean", - :restrict_searchable_attributes => :"Array", - :facets => :"Array", - :faceting_after_distinct => :"Boolean", - :page => :"Integer", - :offset => :"Integer", - :length => :"Integer", - :around_lat_lng => :"String", - :around_lat_lng_via_ip => :"Boolean", - :around_radius => :"AroundRadius", - :around_precision => :"AroundPrecision", - :minimum_around_radius => :"Integer", - :inside_bounding_box => :"Array>", - :inside_polygon => :"Array>", - :natural_languages => :"Array", - :rule_contexts => :"Array", - :personalization_impact => :"Integer", - :user_token => :"String", - :get_ranking_info => :"Boolean", - :synonyms => :"Boolean", - :click_analytics => :"Boolean", - :analytics => :"Boolean", - :analytics_tags => :"Array", - :percentile_computation => :"Boolean", - :enable_ab_test => :"Boolean", - :attributes_to_retrieve => :"Array", - :ranking => :"Array", - :custom_ranking => :"Array", - :relevancy_strictness => :"Integer", - :attributes_to_highlight => :"Array", - :attributes_to_snippet => :"Array", - :highlight_pre_tag => :"String", - :highlight_post_tag => :"String", - :snippet_ellipsis_text => :"String", - :restrict_highlight_and_snippet_arrays => :"Boolean", - :hits_per_page => :"Integer", - :min_word_sizefor1_typo => :"Integer", - :min_word_sizefor2_typos => :"Integer", - :typo_tolerance => :"TypoTolerance", - :allow_typos_on_numeric_tokens => :"Boolean", - :disable_typo_tolerance_on_attributes => :"Array", - :ignore_plurals => :"IgnorePlurals", - :remove_stop_words => :"RemoveStopWords", - :keep_diacritics_on_characters => :"String", - :query_languages => :"Array", - :decompound_query => :"Boolean", - :enable_rules => :"Boolean", - :enable_personalization => :"Boolean", - :query_type => :"QueryType", - :remove_words_if_no_results => :"RemoveWordsIfNoResults", - :mode => :"Mode", - :semantic_search => :"SemanticSearch", - :advanced_syntax => :"Boolean", - :optional_words => :"Array", - :disable_exact_on_attributes => :"Array", - :exact_on_single_word_query => :"ExactOnSingleWordQuery", - :alternatives_as_exact => :"Array", - :advanced_syntax_features => :"Array", - :distinct => :"Distinct", - :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", - :rendering_content => :"RenderingContent", - :enable_re_ranking => :"Boolean", - :re_ranking_apply_filter => :"ReRankingApplyFilter" - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new( - [] - ) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :"BaseSearchParams", - :"IndexSettingsAsSearchParams" - ] - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - raise( - ArgumentError, - "The input argument (attributes) must be a hash in `Algolia::SearchParamsObject` initialize method" - ) - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - raise( - ArgumentError, - "`#{k}` is not a valid attribute in `Algolia::SearchParamsObject`. Please check the name to make sure it's valid. List of attributes: " + - self.class.attribute_map.keys.inspect - ) - end - - h[k.to_sym] = v - } - - if attributes.key?(:query) - self.query = attributes[:query] - end - - if attributes.key?(:similar_query) - self.similar_query = attributes[:similar_query] - end - - if attributes.key?(:filters) - self.filters = attributes[:filters] - end - - if attributes.key?(:facet_filters) - self.facet_filters = attributes[:facet_filters] - end - - if attributes.key?(:optional_filters) - self.optional_filters = attributes[:optional_filters] - end - - if attributes.key?(:numeric_filters) - self.numeric_filters = attributes[:numeric_filters] - end - - if attributes.key?(:tag_filters) - self.tag_filters = attributes[:tag_filters] - end - - if attributes.key?(:sum_or_filters_scores) - self.sum_or_filters_scores = attributes[:sum_or_filters_scores] - end - - if attributes.key?(:restrict_searchable_attributes) - if (value = attributes[:restrict_searchable_attributes]).is_a?(Array) - self.restrict_searchable_attributes = value - end - end - - if attributes.key?(:facets) - if (value = attributes[:facets]).is_a?(Array) - self.facets = value - end - end - - if attributes.key?(:faceting_after_distinct) - self.faceting_after_distinct = attributes[:faceting_after_distinct] - end - - if attributes.key?(:page) - self.page = attributes[:page] - end - - if attributes.key?(:offset) - self.offset = attributes[:offset] - end - - if attributes.key?(:length) - self.length = attributes[:length] - end - - if attributes.key?(:around_lat_lng) - self.around_lat_lng = attributes[:around_lat_lng] - end - - if attributes.key?(:around_lat_lng_via_ip) - self.around_lat_lng_via_ip = attributes[:around_lat_lng_via_ip] - end - - if attributes.key?(:around_radius) - self.around_radius = attributes[:around_radius] - end - - if attributes.key?(:around_precision) - self.around_precision = attributes[:around_precision] - end - - if attributes.key?(:minimum_around_radius) - self.minimum_around_radius = attributes[:minimum_around_radius] - end - - if attributes.key?(:inside_bounding_box) - if (value = attributes[:inside_bounding_box]).is_a?(Array) - self.inside_bounding_box = value - end - end - - if attributes.key?(:inside_polygon) - if (value = attributes[:inside_polygon]).is_a?(Array) - self.inside_polygon = value - end - end - - if attributes.key?(:natural_languages) - if (value = attributes[:natural_languages]).is_a?(Array) - self.natural_languages = value - end - end - - if attributes.key?(:rule_contexts) - if (value = attributes[:rule_contexts]).is_a?(Array) - self.rule_contexts = value - end - end - - if attributes.key?(:personalization_impact) - self.personalization_impact = attributes[:personalization_impact] - end - - if attributes.key?(:user_token) - self.user_token = attributes[:user_token] - end - - if attributes.key?(:get_ranking_info) - self.get_ranking_info = attributes[:get_ranking_info] - end - - if attributes.key?(:synonyms) - self.synonyms = attributes[:synonyms] - end - - if attributes.key?(:click_analytics) - self.click_analytics = attributes[:click_analytics] - end - - if attributes.key?(:analytics) - self.analytics = attributes[:analytics] - end - - if attributes.key?(:analytics_tags) - if (value = attributes[:analytics_tags]).is_a?(Array) - self.analytics_tags = value - end - end - - if attributes.key?(:percentile_computation) - self.percentile_computation = attributes[:percentile_computation] - end - - if attributes.key?(:enable_ab_test) - self.enable_ab_test = attributes[:enable_ab_test] - end - - if attributes.key?(:attributes_to_retrieve) - if (value = attributes[:attributes_to_retrieve]).is_a?(Array) - self.attributes_to_retrieve = value - end - end - - if attributes.key?(:ranking) - if (value = attributes[:ranking]).is_a?(Array) - self.ranking = value - end - end - - if attributes.key?(:custom_ranking) - if (value = attributes[:custom_ranking]).is_a?(Array) - self.custom_ranking = value - end - end - - if attributes.key?(:relevancy_strictness) - self.relevancy_strictness = attributes[:relevancy_strictness] - end - - if attributes.key?(:attributes_to_highlight) - if (value = attributes[:attributes_to_highlight]).is_a?(Array) - self.attributes_to_highlight = value - end - end - - if attributes.key?(:attributes_to_snippet) - if (value = attributes[:attributes_to_snippet]).is_a?(Array) - self.attributes_to_snippet = value - end - end - - if attributes.key?(:highlight_pre_tag) - self.highlight_pre_tag = attributes[:highlight_pre_tag] - end - - if attributes.key?(:highlight_post_tag) - self.highlight_post_tag = attributes[:highlight_post_tag] - end - - if attributes.key?(:snippet_ellipsis_text) - self.snippet_ellipsis_text = attributes[:snippet_ellipsis_text] - end - - if attributes.key?(:restrict_highlight_and_snippet_arrays) - self.restrict_highlight_and_snippet_arrays = attributes[:restrict_highlight_and_snippet_arrays] - end - - if attributes.key?(:hits_per_page) - self.hits_per_page = attributes[:hits_per_page] - end - - if attributes.key?(:min_word_sizefor1_typo) - self.min_word_sizefor1_typo = attributes[:min_word_sizefor1_typo] - end - - if attributes.key?(:min_word_sizefor2_typos) - self.min_word_sizefor2_typos = attributes[:min_word_sizefor2_typos] - end - - if attributes.key?(:typo_tolerance) - self.typo_tolerance = attributes[:typo_tolerance] - end - - if attributes.key?(:allow_typos_on_numeric_tokens) - self.allow_typos_on_numeric_tokens = attributes[:allow_typos_on_numeric_tokens] - end - - if attributes.key?(:disable_typo_tolerance_on_attributes) - if (value = attributes[:disable_typo_tolerance_on_attributes]).is_a?(Array) - self.disable_typo_tolerance_on_attributes = value - end - end - - if attributes.key?(:ignore_plurals) - self.ignore_plurals = attributes[:ignore_plurals] - end - - if attributes.key?(:remove_stop_words) - self.remove_stop_words = attributes[:remove_stop_words] - end - - if attributes.key?(:keep_diacritics_on_characters) - self.keep_diacritics_on_characters = attributes[:keep_diacritics_on_characters] - end - - if attributes.key?(:query_languages) - if (value = attributes[:query_languages]).is_a?(Array) - self.query_languages = value - end - end - - if attributes.key?(:decompound_query) - self.decompound_query = attributes[:decompound_query] - end - - if attributes.key?(:enable_rules) - self.enable_rules = attributes[:enable_rules] - end - - if attributes.key?(:enable_personalization) - self.enable_personalization = attributes[:enable_personalization] - end - - if attributes.key?(:query_type) - self.query_type = attributes[:query_type] - end - - if attributes.key?(:remove_words_if_no_results) - self.remove_words_if_no_results = attributes[:remove_words_if_no_results] - end - - if attributes.key?(:mode) - self.mode = attributes[:mode] - end - - if attributes.key?(:semantic_search) - self.semantic_search = attributes[:semantic_search] - end - - if attributes.key?(:advanced_syntax) - self.advanced_syntax = attributes[:advanced_syntax] - end - - if attributes.key?(:optional_words) - if (value = attributes[:optional_words]).is_a?(Array) - self.optional_words = value - end - end - - if attributes.key?(:disable_exact_on_attributes) - if (value = attributes[:disable_exact_on_attributes]).is_a?(Array) - self.disable_exact_on_attributes = value - end - end - - if attributes.key?(:exact_on_single_word_query) - self.exact_on_single_word_query = attributes[:exact_on_single_word_query] - end - - if attributes.key?(:alternatives_as_exact) - if (value = attributes[:alternatives_as_exact]).is_a?(Array) - self.alternatives_as_exact = value - end - end - - if attributes.key?(:advanced_syntax_features) - if (value = attributes[:advanced_syntax_features]).is_a?(Array) - self.advanced_syntax_features = value - end - end - - if attributes.key?(:distinct) - self.distinct = attributes[:distinct] - end - - if attributes.key?(:replace_synonyms_in_highlight) - self.replace_synonyms_in_highlight = attributes[:replace_synonyms_in_highlight] - end - - if attributes.key?(:min_proximity) - self.min_proximity = attributes[:min_proximity] - end - - if attributes.key?(:response_fields) - if (value = attributes[:response_fields]).is_a?(Array) - self.response_fields = value - 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 - - if attributes.key?(:sort_facet_values_by) - self.sort_facet_values_by = attributes[:sort_facet_values_by] - end - - if attributes.key?(:attribute_criteria_computed_by_min_proximity) - self.attribute_criteria_computed_by_min_proximity = attributes[:attribute_criteria_computed_by_min_proximity] - end - - if attributes.key?(:rendering_content) - self.rendering_content = attributes[:rendering_content] - end - - if attributes.key?(:enable_re_ranking) - self.enable_re_ranking = attributes[:enable_re_ranking] - end - - if attributes.key?(:re_ranking_apply_filter) - self.re_ranking_apply_filter = attributes[:re_ranking_apply_filter] - end - end - - # Custom attribute writer method with validation - # @param [Object] page Value to be assigned - def page=(page) - if page.nil? - raise ArgumentError, "page cannot be nil" - end - - if page < 0 - raise ArgumentError, "invalid value for \"page\", must be greater than or equal to 0." - end - - @page = page - end - - # Custom attribute writer method with validation - # @param [Object] length Value to be assigned - def length=(length) - if length.nil? - raise ArgumentError, "length cannot be nil" - end - - if length > 1000 - raise ArgumentError, "invalid value for \"length\", must be smaller than or equal to 1000." - end - - if length < 0 - raise ArgumentError, "invalid value for \"length\", must be greater than or equal to 0." - end - - @length = length - end - - # Custom attribute writer method with validation - # @param [Object] minimum_around_radius Value to be assigned - def minimum_around_radius=(minimum_around_radius) - if minimum_around_radius.nil? - raise ArgumentError, "minimum_around_radius cannot be nil" - end - - if minimum_around_radius < 1 - raise ArgumentError, "invalid value for \"minimum_around_radius\", must be greater than or equal to 1." - end - - @minimum_around_radius = minimum_around_radius - end - - # Custom attribute writer method with validation - # @param [Object] personalization_impact Value to be assigned - def personalization_impact=(personalization_impact) - if personalization_impact.nil? - raise ArgumentError, "personalization_impact cannot be nil" - end - - if personalization_impact > 100 - raise ArgumentError, "invalid value for \"personalization_impact\", must be smaller than or equal to 100." - end - - if personalization_impact < 0 - raise ArgumentError, "invalid value for \"personalization_impact\", must be greater than or equal to 0." - end - - @personalization_impact = personalization_impact - end - - # Custom attribute writer method with validation - # @param [Object] hits_per_page Value to be assigned - def hits_per_page=(hits_per_page) - if hits_per_page.nil? - raise ArgumentError, "hits_per_page cannot be nil" - end - - if hits_per_page > 1000 - raise ArgumentError, "invalid value for \"hits_per_page\", must be smaller than or equal to 1000." - end - - if hits_per_page < 1 - raise ArgumentError, "invalid value for \"hits_per_page\", must be greater than or equal to 1." - end - - @hits_per_page = hits_per_page - end - - # Custom attribute writer method with validation - # @param [Object] min_proximity Value to be assigned - def min_proximity=(min_proximity) - if min_proximity.nil? - raise ArgumentError, "min_proximity cannot be nil" - end - - if min_proximity > 7 - raise ArgumentError, "invalid value for \"min_proximity\", must be smaller than or equal to 7." - end - - if min_proximity < 1 - raise ArgumentError, "invalid value for \"min_proximity\", must be greater than or equal to 1." - end - - @min_proximity = min_proximity - end - - # Custom attribute writer method with validation - # @param [Object] max_facet_hits Value to be assigned - def max_facet_hits=(max_facet_hits) - if max_facet_hits.nil? - raise ArgumentError, "max_facet_hits cannot be nil" - end - - if max_facet_hits > 100 - raise ArgumentError, "invalid value for \"max_facet_hits\", must be smaller than or equal to 100." - end - - @max_facet_hits = max_facet_hits - end - - # Custom attribute writer method with validation - # @param [Object] max_values_per_facet Value to be assigned - def max_values_per_facet=(max_values_per_facet) - if max_values_per_facet.nil? - raise ArgumentError, "max_values_per_facet cannot be nil" - end - - if max_values_per_facet > 1000 - raise ArgumentError, "invalid value for \"max_values_per_facet\", must be smaller than or equal to 1000." - end - - @max_values_per_facet = max_values_per_facet - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.equal?(other) - self.class == other.class && - query == other.query && - similar_query == other.similar_query && - filters == other.filters && - facet_filters == other.facet_filters && - optional_filters == other.optional_filters && - numeric_filters == other.numeric_filters && - tag_filters == other.tag_filters && - sum_or_filters_scores == other.sum_or_filters_scores && - restrict_searchable_attributes == other.restrict_searchable_attributes && - facets == other.facets && - faceting_after_distinct == other.faceting_after_distinct && - page == other.page && - offset == other.offset && - length == other.length && - around_lat_lng == other.around_lat_lng && - around_lat_lng_via_ip == other.around_lat_lng_via_ip && - around_radius == other.around_radius && - around_precision == other.around_precision && - minimum_around_radius == other.minimum_around_radius && - inside_bounding_box == other.inside_bounding_box && - inside_polygon == other.inside_polygon && - natural_languages == other.natural_languages && - rule_contexts == other.rule_contexts && - personalization_impact == other.personalization_impact && - user_token == other.user_token && - get_ranking_info == other.get_ranking_info && - synonyms == other.synonyms && - click_analytics == other.click_analytics && - analytics == other.analytics && - analytics_tags == other.analytics_tags && - percentile_computation == other.percentile_computation && - enable_ab_test == other.enable_ab_test && - attributes_to_retrieve == other.attributes_to_retrieve && - ranking == other.ranking && - custom_ranking == other.custom_ranking && - relevancy_strictness == other.relevancy_strictness && - attributes_to_highlight == other.attributes_to_highlight && - attributes_to_snippet == other.attributes_to_snippet && - highlight_pre_tag == other.highlight_pre_tag && - highlight_post_tag == other.highlight_post_tag && - snippet_ellipsis_text == other.snippet_ellipsis_text && - restrict_highlight_and_snippet_arrays == other.restrict_highlight_and_snippet_arrays && - hits_per_page == other.hits_per_page && - min_word_sizefor1_typo == other.min_word_sizefor1_typo && - min_word_sizefor2_typos == other.min_word_sizefor2_typos && - typo_tolerance == other.typo_tolerance && - allow_typos_on_numeric_tokens == other.allow_typos_on_numeric_tokens && - disable_typo_tolerance_on_attributes == other.disable_typo_tolerance_on_attributes && - ignore_plurals == other.ignore_plurals && - remove_stop_words == other.remove_stop_words && - keep_diacritics_on_characters == other.keep_diacritics_on_characters && - query_languages == other.query_languages && - decompound_query == other.decompound_query && - enable_rules == other.enable_rules && - enable_personalization == other.enable_personalization && - query_type == other.query_type && - remove_words_if_no_results == other.remove_words_if_no_results && - mode == other.mode && - semantic_search == other.semantic_search && - advanced_syntax == other.advanced_syntax && - optional_words == other.optional_words && - disable_exact_on_attributes == other.disable_exact_on_attributes && - exact_on_single_word_query == other.exact_on_single_word_query && - alternatives_as_exact == other.alternatives_as_exact && - advanced_syntax_features == other.advanced_syntax_features && - distinct == other.distinct && - 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 && - rendering_content == other.rendering_content && - enable_re_ranking == other.enable_re_ranking && - re_ranking_apply_filter == other.re_ranking_apply_filter - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [ - query, - similar_query, - filters, - facet_filters, - optional_filters, - numeric_filters, - tag_filters, - sum_or_filters_scores, - restrict_searchable_attributes, - facets, - faceting_after_distinct, - page, - offset, - length, - around_lat_lng, - around_lat_lng_via_ip, - around_radius, - around_precision, - minimum_around_radius, - inside_bounding_box, - inside_polygon, - natural_languages, - rule_contexts, - personalization_impact, - user_token, - get_ranking_info, - synonyms, - click_analytics, - analytics, - analytics_tags, - percentile_computation, - enable_ab_test, - attributes_to_retrieve, - ranking, - custom_ranking, - relevancy_strictness, - attributes_to_highlight, - attributes_to_snippet, - highlight_pre_tag, - highlight_post_tag, - snippet_ellipsis_text, - restrict_highlight_and_snippet_arrays, - hits_per_page, - min_word_sizefor1_typo, - min_word_sizefor2_typos, - typo_tolerance, - allow_typos_on_numeric_tokens, - disable_typo_tolerance_on_attributes, - ignore_plurals, - remove_stop_words, - keep_diacritics_on_characters, - query_languages, - decompound_query, - enable_rules, - enable_personalization, - query_type, - remove_words_if_no_results, - mode, - semantic_search, - advanced_syntax, - optional_words, - disable_exact_on_attributes, - exact_on_single_word_query, - alternatives_as_exact, - advanced_syntax_features, - distinct, - 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, - rendering_content, - enable_re_ranking, - re_ranking_apply_filter - ].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - types_mapping.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| - _deserialize(::Regexp.last_match(1), v) - } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]]) - end - end - - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - # model - else - # models (e.g. Pet) or oneOf - klass = Algolia::Recommend.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass - .build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - def to_json(*_args) - to_hash.to_json - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to?(:to_hash) - value.to_hash - else - value - end - end - - end - - end -end diff --git a/lib/algolia/models/recommend/semantic_search.rb b/lib/algolia/models/recommend/semantic_search.rb deleted file mode 100644 index e7637edb..00000000 --- a/lib/algolia/models/recommend/semantic_search.rb +++ /dev/null @@ -1,217 +0,0 @@ -# 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 - # Settings for the semantic search part of NeuralSearch. Only used when `mode` is `neuralSearch`. - class SemanticSearch - # Indices from which to collect click and conversion events. If null, the current index and all its replicas are used. - attr_accessor :event_sources - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :event_sources => :eventSources - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.types_mapping - { - :event_sources => :"Array" - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new( - [ - :event_sources - ] - ) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - raise( - ArgumentError, - "The input argument (attributes) must be a hash in `Algolia::SemanticSearch` initialize method" - ) - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - raise( - ArgumentError, - "`#{k}` is not a valid attribute in `Algolia::SemanticSearch`. Please check the name to make sure it's valid. List of attributes: " + - self.class.attribute_map.keys.inspect - ) - end - - h[k.to_sym] = v - } - - if attributes.key?(:event_sources) - if (value = attributes[:event_sources]).is_a?(Array) - self.event_sources = value - end - end - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.equal?(other) - self.class == other.class && - event_sources == other.event_sources - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [event_sources].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - types_mapping.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| - _deserialize(::Regexp.last_match(1), v) - } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]]) - end - end - - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - # model - else - # models (e.g. Pet) or oneOf - klass = Algolia::Recommend.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass - .build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - def to_json(*_args) - to_hash.to_json - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to?(:to_hash) - value.to_hash - else - value - end - end - - end - - end -end diff --git a/lib/algolia/models/recommend/trending_facets_query.rb b/lib/algolia/models/recommend/trending_facets_query.rb index 37c53216..88a8e5f4 100644 --- a/lib/algolia/models/recommend/trending_facets_query.rb +++ b/lib/algolia/models/recommend/trending_facets_query.rb @@ -48,7 +48,7 @@ def self.types_mapping :index_name => :"String", :threshold => :"Float", :max_recommendations => :"Integer", - :query_parameters => :"SearchParams", + :query_parameters => :"RecommendSearchParams", :facet_name => :"Object", :model => :"TrendingFacetsModel", :fallback_parameters => :"FallbackParams" diff --git a/lib/algolia/models/recommend/trending_items_query.rb b/lib/algolia/models/recommend/trending_items_query.rb index 63a43482..d2965bd9 100644 --- a/lib/algolia/models/recommend/trending_items_query.rb +++ b/lib/algolia/models/recommend/trending_items_query.rb @@ -52,11 +52,11 @@ def self.types_mapping :index_name => :"String", :threshold => :"Float", :max_recommendations => :"Integer", - :query_parameters => :"SearchParams", + :query_parameters => :"RecommendSearchParams", :facet_name => :"String", :facet_value => :"String", :model => :"TrendingItemsModel", - :fallback_parameters => :"SearchParamsObject" + :fallback_parameters => :"FallbackParams" } end