Class: Algolia::Composition::BaseInjectionQueryParameters

Inherits:
Object
  • Object
show all
Defined in:
lib/algolia/models/composition/base_injection_query_parameters.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BaseInjectionQueryParameters

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 258

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    raise(
      ArgumentError,
      "The input argument (attributes) must be a hash in `Algolia::BaseInjectionQueryParameters` 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::BaseInjectionQueryParameters`. 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?(:advanced_syntax)
    self.advanced_syntax = attributes[:advanced_syntax]
  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?(:allow_typos_on_numeric_tokens)
    self.allow_typos_on_numeric_tokens = attributes[:allow_typos_on_numeric_tokens]
  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?(:analytics)
    self.analytics = attributes[:analytics]
  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?(:attributes_to_highlight)
    if (value = attributes[:attributes_to_highlight]).is_a?(Array)
      self.attributes_to_highlight = 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?(:attributes_to_snippet)
    if (value = attributes[:attributes_to_snippet]).is_a?(Array)
      self.attributes_to_snippet = value
    end
  end

  if attributes.key?(:click_analytics)
    self.click_analytics = attributes[:click_analytics]
  end

  if attributes.key?(:decompound_query)
    self.decompound_query = attributes[:decompound_query]
  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?(: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?(:distinct)
    self.distinct = attributes[:distinct]
  end

  if attributes.key?(:enable_ab_test)
    self.enable_ab_test = attributes[:enable_ab_test]
  end

  if attributes.key?(:enable_personalization)
    self.enable_personalization = attributes[:enable_personalization]
  end

  if attributes.key?(:enable_re_ranking)
    self.enable_re_ranking = attributes[:enable_re_ranking]
  end

  if attributes.key?(:enable_rules)
    self.enable_rules = attributes[:enable_rules]
  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?(:facet_filters)
    self.facet_filters = attributes[:facet_filters]
  end

  if attributes.key?(:filters)
    self.filters = attributes[:filters]
  end

  if attributes.key?(:get_ranking_info)
    self.get_ranking_info = attributes[:get_ranking_info]
  end

  if attributes.key?(:highlight_post_tag)
    self. = attributes[:highlight_post_tag]
  end

  if attributes.key?(:highlight_pre_tag)
    self.highlight_pre_tag = attributes[:highlight_pre_tag]
  end

  if attributes.key?(:ignore_plurals)
    self.ignore_plurals = attributes[:ignore_plurals]
  end

  if attributes.key?(:max_facet_hits)
    self.max_facet_hits = attributes[:max_facet_hits]
  end

  if attributes.key?(:min_proximity)
    self.min_proximity = attributes[:min_proximity]
  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?(:natural_languages)
    if (value = attributes[:natural_languages]).is_a?(Array)
      self.natural_languages = value
    end
  end

  if attributes.key?(:numeric_filters)
    self.numeric_filters = attributes[:numeric_filters]
  end

  if attributes.key?(:optional_filters)
    self.optional_filters = attributes[:optional_filters]
  end

  if attributes.key?(:optional_words)
    self.optional_words = attributes[:optional_words]
  end

  if attributes.key?(:percentile_computation)
    self.percentile_computation = attributes[:percentile_computation]
  end

  if attributes.key?(:personalization_impact)
    self.personalization_impact = attributes[:personalization_impact]
  end

  if attributes.key?(:query_languages)
    if (value = attributes[:query_languages]).is_a?(Array)
      self.query_languages = value
    end
  end

  if attributes.key?(:query_type)
    self.query_type = attributes[:query_type]
  end

  if attributes.key?(:remove_stop_words)
    self.remove_stop_words = attributes[:remove_stop_words]
  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?(:replace_synonyms_in_highlight)
    self.replace_synonyms_in_highlight = attributes[:replace_synonyms_in_highlight]
  end

  if attributes.key?(:response_fields)
    if (value = attributes[:response_fields]).is_a?(Array)
      self.response_fields = value
    end
  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?(:restrict_searchable_attributes)
    if (value = attributes[:restrict_searchable_attributes]).is_a?(Array)
      self.restrict_searchable_attributes = 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?(:snippet_ellipsis_text)
    self.snippet_ellipsis_text = attributes[:snippet_ellipsis_text]
  end

  if attributes.key?(:synonyms)
    self.synonyms = attributes[:synonyms]
  end

  if attributes.key?(:typo_tolerance)
    self.typo_tolerance = attributes[:typo_tolerance]
  end
end

Instance Attribute Details

#advanced_syntaxObject

Whether to support phrase matching and excluding words from search queries Use the ‘advancedSyntaxFeatures` parameter to control which feature is supported.



12
13
14
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 12

def advanced_syntax
  @advanced_syntax
end

#advanced_syntax_featuresObject

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.



15
16
17
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 15

def advanced_syntax_features
  @advanced_syntax_features
end

#allow_typos_on_numeric_tokensObject

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.



18
19
20
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 18

def allow_typos_on_numeric_tokens
  @allow_typos_on_numeric_tokens
end

#alternatives_as_exactObject

Determine which plurals and synonyms should be considered an exact matches By default, Algolia treats singular and plural forms of a word, and single-word synonyms, as [exact](www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#exact) matches when searching. For example - "swimsuit" and "swimsuits" are treated the same - "swimsuit" and "swimwear" are treated the same (if they are [synonyms](www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#regular-synonyms)) - ‘ignorePlurals`. Plurals and similar declensions added by the `ignorePlurals` setting are considered exact matches - `singleWordSynonym`. Single-word synonyms, such as "NY" = "NYC", are considered exact matches - `multiWordsSynonym`. Multi-word synonyms, such as "NY" = "New York", are considered exact matches.



21
22
23
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 21

def alternatives_as_exact
  @alternatives_as_exact
end

#analyticsObject

Whether this search will be included in Analytics.



24
25
26
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 24

def analytics
  @analytics
end

#attribute_criteria_computed_by_min_proximityObject

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.



27
28
29
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 27

def attribute_criteria_computed_by_min_proximity
  @attribute_criteria_computed_by_min_proximity
end

#attributes_to_highlightObject

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](www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/highlighting-snippeting/js/).



30
31
32
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 30

def attributes_to_highlight
  @attributes_to_highlight
end

#attributes_to_retrieveObject

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.



33
34
35
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 33

def attributes_to_retrieve
  @attributes_to_retrieve
end

#attributes_to_snippetObject

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.



36
37
38
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 36

def attributes_to_snippet
  @attributes_to_snippet
end

#click_analyticsObject

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](www.algolia.com/guides/sending-events/getting-started/).



39
40
41
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 39

def click_analytics
  @click_analytics
end

#decompound_queryObject

Whether to split compound words in the query into their building blocks For more information, see [Word segmentation](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](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).



42
43
44
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 42

def decompound_query
  @decompound_query
end

#disable_exact_on_attributesObject

Searchable attributes for which you want to [turn off the Exact ranking criterion](www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking.



45
46
47
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 45

def disable_exact_on_attributes
  @disable_exact_on_attributes
end

#disable_typo_tolerance_on_attributesObject

Attributes for which you want to turn off [typo tolerance](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](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.



48
49
50
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 48

def disable_typo_tolerance_on_attributes
  @disable_typo_tolerance_on_attributes
end

#distinctObject

Returns the value of attribute distinct.



50
51
52
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 50

def distinct
  @distinct
end

#enable_ab_testObject

Whether to enable A/B testing for this search.



53
54
55
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 53

def enable_ab_test
  @enable_ab_test
end

#enable_personalizationObject

Whether to enable Personalization.



56
57
58
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 56

def enable_personalization
  @enable_personalization
end

#enable_re_rankingObject

Whether this search will use [Dynamic Re-Ranking](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.



59
60
61
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 59

def enable_re_ranking
  @enable_re_ranking
end

#enable_rulesObject

Whether to enable rules.



62
63
64
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 62

def enable_rules
  @enable_rules
end

#exact_on_single_word_queryObject

Returns the value of attribute exact_on_single_word_query.



64
65
66
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 64

def exact_on_single_word_query
  @exact_on_single_word_query
end

#facet_filtersObject

Returns the value of attribute facet_filters.



66
67
68
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 66

def facet_filters
  @facet_filters
end

#filtersObject

Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** ‘<facet> <op> <number>`, where `<op>` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - Ranges. `<facet>:<lower> TO <upper>` where `<lower>` and `<upper>` are the lower and upper limits of the range (inclusive). - **Facet filters.** `<facet>:<value>` where `<facet>` is a facet attribute (case-sensitive) and `<value>` a facet value. - **Tag filters.** `_tags:<value>` or just `<value>` (case-sensitive). - **Boolean filters.** `<facet>: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can’t use ‘NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can’t combine conjunctions (‘AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes 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](www.algolia.com/doc/guides/managing-results/refine-results/filtering/).



69
70
71
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 69

def filters
  @filters
end

#get_ranking_infoObject

Whether the search response should include detailed ranking information.



72
73
74
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 72

def get_ranking_info
  @get_ranking_info
end

#highlight_post_tagObject

HTML tag to insert after the highlighted parts in all highlighted results and snippets.



75
76
77
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 75

def 
  @highlight_post_tag
end

#highlight_pre_tagObject

HTML tag to insert before the highlighted parts in all highlighted results and snippets.



78
79
80
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 78

def highlight_pre_tag
  @highlight_pre_tag
end

#ignore_pluralsObject

Returns the value of attribute ignore_plurals.



80
81
82
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 80

def ignore_plurals
  @ignore_plurals
end

#max_facet_hitsObject

Maximum number of facet values to return when [searching for facet values](www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).



83
84
85
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 83

def max_facet_hits
  @max_facet_hits
end

#min_proximityObject

Minimum proximity score for two matching words This adjusts the [Proximity ranking criterion](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.



86
87
88
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 86

def min_proximity
  @min_proximity
end

#min_word_sizefor1_typoObject

Minimum number of characters a word in the search query must contain to accept matches with [one typo](www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos).



89
90
91
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 89

def min_word_sizefor1_typo
  @min_word_sizefor1_typo
end

#min_word_sizefor2_typosObject

Minimum number of characters a word in the search query must contain to accept matches with [two typos](www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos).



92
93
94
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 92

def min_word_sizefor2_typos
  @min_word_sizefor2_typos
end

#natural_languagesObject

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`.



95
96
97
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 95

def natural_languages
  @natural_languages
end

#numeric_filtersObject

Returns the value of attribute numeric_filters.



97
98
99
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 97

def numeric_filters
  @numeric_filters
end

#optional_filtersObject

Returns the value of attribute optional_filters.



99
100
101
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 99

def optional_filters
  @optional_filters
end

#optional_wordsObject

Returns the value of attribute optional_words.



101
102
103
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 101

def optional_words
  @optional_words
end

#percentile_computationObject

Whether to include this search when calculating processing-time percentiles.



104
105
106
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 104

def percentile_computation
  @percentile_computation
end

#personalization_impactObject

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](www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact).



107
108
109
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 107

def personalization_impact
  @personalization_impact
end

#query_languagesObject

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](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](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](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/).



110
111
112
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 110

def query_languages
  @query_languages
end

#query_typeObject

Returns the value of attribute query_type.



112
113
114
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 112

def query_type
  @query_type
end

#remove_stop_wordsObject

Returns the value of attribute remove_stop_words.



114
115
116
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 114

def remove_stop_words
  @remove_stop_words
end

#remove_words_if_no_resultsObject

Returns the value of attribute remove_words_if_no_results.



116
117
118
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 116

def remove_words_if_no_results
  @remove_words_if_no_results
end

#replace_synonyms_in_highlightObject

Whether to replace a highlighted word with the matched synonym By default, the original words are highlighted even if a synonym matches. For example, with ‘home` as a synonym for `house` and a search for `home`, records matching either "home" or "house" are included in the search results, and either "home" or "house" are highlighted With `replaceSynonymsInHighlight` set to `true`, a search for `home` still matches the same records, but all occurrences of "house" are replaced by "home" in the highlighted response.



119
120
121
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 119

def replace_synonyms_in_highlight
  @replace_synonyms_in_highlight
end

#response_fieldsObject

Properties to include in the API response of search and browse requests By default, all response properties are included. To reduce the response size, you can select which properties should be included An empty list may lead to an empty API response (except properties you can’t exclude) You can’t exclude these properties: ‘message`, `warning`, `cursor`, `abTestVariantID`, or any property added by setting `getRankingInfo` to true Your search depends on the `hits` field. If you omit this field, searches won’t return any results. Your UI might also depend on other properties, for example, for pagination. Before restricting the response size, check the impact on your search experience.



122
123
124
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 122

def response_fields
  @response_fields
end

#restrict_highlight_and_snippet_arraysObject

Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted.



125
126
127
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 125

def restrict_highlight_and_snippet_arrays
  @restrict_highlight_and_snippet_arrays
end

#restrict_searchable_attributesObject

Restricts a search to a subset of your searchable attributes. Attribute names are case-sensitive.



128
129
130
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 128

def restrict_searchable_attributes
  @restrict_searchable_attributes
end

#rule_contextsObject

Assigns a rule context to the search query [Rule contexts](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.



131
132
133
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 131

def rule_contexts
  @rule_contexts
end

#snippet_ellipsis_textObject

String used as an ellipsis indicator when a snippet is truncated.



134
135
136
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 134

def snippet_ellipsis_text
  @snippet_ellipsis_text
end

#synonymsObject

Whether to take into account an index’s synonyms for this search.



137
138
139
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 137

def synonyms
  @synonyms
end

#typo_toleranceObject

Returns the value of attribute typo_tolerance.



139
140
141
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 139

def typo_tolerance
  @typo_tolerance
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 636

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<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\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::Composition.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

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 142

def self.attribute_map
  {
    :advanced_syntax => :advancedSyntax,
    :advanced_syntax_features => :advancedSyntaxFeatures,
    :allow_typos_on_numeric_tokens => :allowTyposOnNumericTokens,
    :alternatives_as_exact => :alternativesAsExact,
    :analytics => :analytics,
    :attribute_criteria_computed_by_min_proximity => :attributeCriteriaComputedByMinProximity,
    :attributes_to_highlight => :attributesToHighlight,
    :attributes_to_retrieve => :attributesToRetrieve,
    :attributes_to_snippet => :attributesToSnippet,
    :click_analytics => :clickAnalytics,
    :decompound_query => :decompoundQuery,
    :disable_exact_on_attributes => :disableExactOnAttributes,
    :disable_typo_tolerance_on_attributes => :disableTypoToleranceOnAttributes,
    :distinct => :distinct,
    :enable_ab_test => :enableABTest,
    :enable_personalization => :enablePersonalization,
    :enable_re_ranking => :enableReRanking,
    :enable_rules => :enableRules,
    :exact_on_single_word_query => :exactOnSingleWordQuery,
    :facet_filters => :facetFilters,
    :filters => :filters,
    :get_ranking_info => :getRankingInfo,
    :highlight_post_tag => :highlightPostTag,
    :highlight_pre_tag => :highlightPreTag,
    :ignore_plurals => :ignorePlurals,
    :max_facet_hits => :maxFacetHits,
    :min_proximity => :minProximity,
    :min_word_sizefor1_typo => :minWordSizefor1Typo,
    :min_word_sizefor2_typos => :minWordSizefor2Typos,
    :natural_languages => :naturalLanguages,
    :numeric_filters => :numericFilters,
    :optional_filters => :optionalFilters,
    :optional_words => :optionalWords,
    :percentile_computation => :percentileComputation,
    :personalization_impact => :personalizationImpact,
    :query_languages => :queryLanguages,
    :query_type => :queryType,
    :remove_stop_words => :removeStopWords,
    :remove_words_if_no_results => :removeWordsIfNoResults,
    :replace_synonyms_in_highlight => :replaceSynonymsInHighlight,
    :response_fields => :responseFields,
    :restrict_highlight_and_snippet_arrays => :restrictHighlightAndSnippetArrays,
    :restrict_searchable_attributes => :restrictSearchableAttributes,
    :rule_contexts => :ruleContexts,
    :snippet_ellipsis_text => :snippetEllipsisText,
    :synonyms => :synonyms,
    :typo_tolerance => :typoTolerance
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 609

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

.openapi_nullableObject

List of attributes with nullable: true



248
249
250
251
252
253
254
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 248

def self.openapi_nullable
  Set.new(
    [
      :optional_words
    ]
  )
end

.types_mappingObject

Attribute type mapping.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 195

def self.types_mapping
  {
    :advanced_syntax => :"Boolean",
    :advanced_syntax_features => :"Array<AdvancedSyntaxFeatures>",
    :allow_typos_on_numeric_tokens => :"Boolean",
    :alternatives_as_exact => :"Array<AlternativesAsExact>",
    :analytics => :"Boolean",
    :attribute_criteria_computed_by_min_proximity => :"Boolean",
    :attributes_to_highlight => :"Array<String>",
    :attributes_to_retrieve => :"Array<String>",
    :attributes_to_snippet => :"Array<String>",
    :click_analytics => :"Boolean",
    :decompound_query => :"Boolean",
    :disable_exact_on_attributes => :"Array<String>",
    :disable_typo_tolerance_on_attributes => :"Array<String>",
    :distinct => :"Distinct",
    :enable_ab_test => :"Boolean",
    :enable_personalization => :"Boolean",
    :enable_re_ranking => :"Boolean",
    :enable_rules => :"Boolean",
    :exact_on_single_word_query => :"ExactOnSingleWordQuery",
    :facet_filters => :"FacetFilters",
    :filters => :"String",
    :get_ranking_info => :"Boolean",
    :highlight_post_tag => :"String",
    :highlight_pre_tag => :"String",
    :ignore_plurals => :"IgnorePlurals",
    :max_facet_hits => :"Integer",
    :min_proximity => :"Integer",
    :min_word_sizefor1_typo => :"Integer",
    :min_word_sizefor2_typos => :"Integer",
    :natural_languages => :"Array<SupportedLanguage>",
    :numeric_filters => :"NumericFilters",
    :optional_filters => :"OptionalFilters",
    :optional_words => :"OptionalWords",
    :percentile_computation => :"Boolean",
    :personalization_impact => :"Integer",
    :query_languages => :"Array<SupportedLanguage>",
    :query_type => :"QueryType",
    :remove_stop_words => :"RemoveStopWords",
    :remove_words_if_no_results => :"RemoveWordsIfNoResults",
    :replace_synonyms_in_highlight => :"Boolean",
    :response_fields => :"Array<String>",
    :restrict_highlight_and_snippet_arrays => :"Boolean",
    :restrict_searchable_attributes => :"Array<String>",
    :rule_contexts => :"Array<String>",
    :snippet_ellipsis_text => :"String",
    :synonyms => :"Boolean",
    :typo_tolerance => :"TypoTolerance"
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 494

def ==(other)
  return true if self.equal?(other)
  self.class == other.class &&
    advanced_syntax == other.advanced_syntax &&
    advanced_syntax_features == other.advanced_syntax_features &&
    allow_typos_on_numeric_tokens == other.allow_typos_on_numeric_tokens &&
    alternatives_as_exact == other.alternatives_as_exact &&
    analytics == other.analytics &&
    attribute_criteria_computed_by_min_proximity == other.attribute_criteria_computed_by_min_proximity &&
    attributes_to_highlight == other.attributes_to_highlight &&
    attributes_to_retrieve == other.attributes_to_retrieve &&
    attributes_to_snippet == other.attributes_to_snippet &&
    click_analytics == other.click_analytics &&
    decompound_query == other.decompound_query &&
    disable_exact_on_attributes == other.disable_exact_on_attributes &&
    disable_typo_tolerance_on_attributes == other.disable_typo_tolerance_on_attributes &&
    distinct == other.distinct &&
    enable_ab_test == other.enable_ab_test &&
    enable_personalization == other.enable_personalization &&
    enable_re_ranking == other.enable_re_ranking &&
    enable_rules == other.enable_rules &&
    exact_on_single_word_query == other.exact_on_single_word_query &&
    facet_filters == other.facet_filters &&
    filters == other.filters &&
    get_ranking_info == other.get_ranking_info &&
     == other. &&
    highlight_pre_tag == other.highlight_pre_tag &&
    ignore_plurals == other.ignore_plurals &&
    max_facet_hits == other.max_facet_hits &&
    min_proximity == other.min_proximity &&
    min_word_sizefor1_typo == other.min_word_sizefor1_typo &&
    min_word_sizefor2_typos == other.min_word_sizefor2_typos &&
    natural_languages == other.natural_languages &&
    numeric_filters == other.numeric_filters &&
    optional_filters == other.optional_filters &&
    optional_words == other.optional_words &&
    percentile_computation == other.percentile_computation &&
    personalization_impact == other.personalization_impact &&
    query_languages == other.query_languages &&
    query_type == other.query_type &&
    remove_stop_words == other.remove_stop_words &&
    remove_words_if_no_results == other.remove_words_if_no_results &&
    replace_synonyms_in_highlight == other.replace_synonyms_in_highlight &&
    response_fields == other.response_fields &&
    restrict_highlight_and_snippet_arrays == other.restrict_highlight_and_snippet_arrays &&
    restrict_searchable_attributes == other.restrict_searchable_attributes &&
    rule_contexts == other.rule_contexts &&
    snippet_ellipsis_text == other.snippet_ellipsis_text &&
    synonyms == other.synonyms &&
    typo_tolerance == other.typo_tolerance
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



715
716
717
718
719
720
721
722
723
724
725
726
727
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 715

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

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


548
549
550
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 548

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 554

def hash
  [
    advanced_syntax,
    advanced_syntax_features,
    allow_typos_on_numeric_tokens,
    alternatives_as_exact,
    analytics,
    attribute_criteria_computed_by_min_proximity,
    attributes_to_highlight,
    attributes_to_retrieve,
    attributes_to_snippet,
    click_analytics,
    decompound_query,
    disable_exact_on_attributes,
    disable_typo_tolerance_on_attributes,
    distinct,
    enable_ab_test,
    enable_personalization,
    enable_re_ranking,
    enable_rules,
    exact_on_single_word_query,
    facet_filters,
    filters,
    get_ranking_info,
    ,
    highlight_pre_tag,
    ignore_plurals,
    max_facet_hits,
    min_proximity,
    min_word_sizefor1_typo,
    min_word_sizefor2_typos,
    natural_languages,
    numeric_filters,
    optional_filters,
    optional_words,
    percentile_computation,
    personalization_impact,
    query_languages,
    query_type,
    remove_stop_words,
    remove_words_if_no_results,
    replace_synonyms_in_highlight,
    response_fields,
    restrict_highlight_and_snippet_arrays,
    restrict_searchable_attributes,
    rule_contexts,
    snippet_ellipsis_text,
    synonyms,
    typo_tolerance
  ].hash
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



686
687
688
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 686

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



696
697
698
699
700
701
702
703
704
705
706
707
708
709
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 696

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

#to_json(*_args) ⇒ Object



690
691
692
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 690

def to_json(*_args)
  to_hash.to_json
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



680
681
682
# File 'lib/algolia/models/composition/base_injection_query_parameters.rb', line 680

def to_s
  to_hash.to_s
end