# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. require 'date' require 'time' module Algolia module Search class BrowseParamsObject # Text to search for in an index. attr_accessor :query # Overrides the query parameter and performs a more generic search. attr_accessor :similar_query # [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. attr_accessor :filters attr_accessor :facet_filters attr_accessor :optional_filters attr_accessor :numeric_filters attr_accessor :tag_filters # Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. attr_accessor :sum_or_filters_scores # Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). attr_accessor :restrict_searchable_attributes # Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. attr_accessor :facets # Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. attr_accessor :faceting_after_distinct # Page to retrieve (the first page is `0`, not `1`). attr_accessor :page # Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). attr_accessor :offset # Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). attr_accessor :length # Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. attr_accessor :around_lat_lng # Search for entries around a location. The location is automatically computed from the requester's IP address. attr_accessor :around_lat_lng_via_ip attr_accessor :around_radius attr_accessor :around_precision # Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. attr_accessor :minimum_around_radius # Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). attr_accessor :inside_bounding_box # Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). attr_accessor :inside_polygon # Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. attr_accessor :natural_languages # Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. attr_accessor :rule_contexts # Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). attr_accessor :personalization_impact # Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. attr_accessor :user_token # Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). attr_accessor :get_ranking_info # Enriches the API's response with information about how the query was processed. attr_accessor :explain # Whether to take into account an index's synonyms for a particular search. attr_accessor :synonyms # Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). attr_accessor :click_analytics # Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). 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 or exclude a query from the processing-time percentile computation. attr_accessor :percentile_computation # Incidates whether this search will be considered in A/B testing. attr_accessor :enable_ab_test # Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. attr_accessor :attributes_for_faceting # Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. attr_accessor :attributes_to_retrieve # Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). attr_accessor :ranking # Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. attr_accessor :custom_ranking # Relevancy threshold below which less relevant results aren't included in the results. attr_accessor :relevancy_strictness # Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). attr_accessor :attributes_to_highlight # Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. attr_accessor :attributes_to_snippet # HTML string to insert before the highlighted parts in all highlight and snippet results. attr_accessor :highlight_pre_tag # HTML string to insert after the highlighted parts in all highlight and snippet results. attr_accessor :highlight_post_tag # String used as an ellipsis indicator when a snippet is truncated. attr_accessor :snippet_ellipsis_text # Restrict highlighting and snippeting to items that matched the query. 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 query string 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 query string 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 (\"numeric tokens\") in the query string. 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/). attr_accessor :disable_typo_tolerance_on_attributes attr_accessor :ignore_plurals attr_accessor :remove_stop_words # Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). attr_accessor :keep_diacritics_on_characters # Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [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) word detection. attr_accessor :query_languages # [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. attr_accessor :decompound_query # Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. attr_accessor :enable_rules # Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. attr_accessor :enable_personalization attr_accessor :query_type attr_accessor :remove_words_if_no_results attr_accessor :mode attr_accessor :semantic_search # Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). attr_accessor :advanced_syntax # Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. attr_accessor :optional_words # 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). attr_accessor :disable_exact_on_attributes attr_accessor :exact_on_single_word_query # Alternatives that should be considered an exact match by [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). attr_accessor :alternatives_as_exact # Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. attr_accessor :advanced_syntax_features attr_accessor :distinct # Whether to highlight and snippet the original word that matches the synonym or the synonym itself. attr_accessor :replace_synonyms_in_highlight # Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). attr_accessor :min_proximity # Attributes to include in the API response for search and browse queries. attr_accessor :response_fields # Maximum number of facet hits 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 # Controls how facet values are fetched. attr_accessor :sort_facet_values_by # When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. attr_accessor :attribute_criteria_computed_by_min_proximity attr_accessor :rendering_content # Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). attr_accessor :enable_re_ranking attr_accessor :re_ranking_apply_filter # Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. attr_accessor :cursor class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values def initialize(datatype, allowable_values) @allowable_values = allowable_values.map do |value| case datatype.to_s when /Integer/i value.to_i when /Float/i value.to_f else value end end end def valid?(value) !value || allowable_values.include?(value) end end # 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, :explain => :explain, :synonyms => :synonyms, :click_analytics => :clickAnalytics, :analytics => :analytics, :analytics_tags => :analyticsTags, :percentile_computation => :percentileComputation, :enable_ab_test => :enableABTest, :attributes_for_faceting => :attributesForFaceting, :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, :cursor => :cursor } 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, :explain => :'Array', :synonyms => :Boolean, :click_analytics => :Boolean, :analytics => :Boolean, :analytics_tags => :'Array', :percentile_computation => :Boolean, :enable_ab_test => :Boolean, :attributes_for_faceting => :'Array', :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, :cursor => :String } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ :re_ranking_apply_filter ]) end # List of class defined in allOf (OpenAPI v3) def self.openapi_all_of [ :Cursor, :SearchParamsObject ] end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) unless attributes.is_a?(Hash) raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::BrowseParamsObject` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) do |(k, v), h| unless self.class.attribute_map.key?(k.to_sym) raise ArgumentError, "`#{k}` is not a valid attribute in `Algolia::BrowseParamsObject`. 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 end 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?(:explain) if (value = attributes[:explain]).is_a?(Array) self.explain = value end 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_for_faceting) if (value = attributes[:attributes_for_faceting]).is_a?(Array) self.attributes_for_faceting = value end 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 if attributes.key?(:cursor) self.cursor = attributes[:cursor] end 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 < 1 raise ArgumentError, 'invalid value for "length", must be greater than or equal to 1.' 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] 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 # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(other) return true if 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 && explain == other.explain && 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_for_faceting == other.attributes_for_faceting && 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 && cursor == other.cursor 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, explain, synonyms, click_analytics, analytics, analytics_tags, percentile_computation, enable_ab_test, attributes_for_faceting, 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, cursor].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_s] = 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_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash[key.to_s] = _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 else # model # models (e.g. Pet) or oneOf klass = Algolia::Search.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 # 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