Class: Algolia::Search::IndexSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/algolia/models/search/index_settings.rb

Overview

Algolia index settings.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ IndexSettings

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
491
492
493
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
545
546
547
548
549
550
551
552
553
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
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
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
# File 'lib/algolia/models/search/index_settings.rb', line 360

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::IndexSettings` 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::IndexSettings`. 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?(: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_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. = 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

Instance Attribute Details

#advanced_syntaxObject



136
137
138
# File 'lib/algolia/models/search/index_settings.rb', line 136

def advanced_syntax
  @advanced_syntax
end

#advanced_syntax_featuresObject

Allows you to specify which advanced syntax features are active when ‘advancedSyntax` is enabled.



150
151
152
# File 'lib/algolia/models/search/index_settings.rb', line 150

def advanced_syntax_features
  @advanced_syntax_features
end

#allow_compression_of_integer_arrayObject

Incidates whether the engine compresses arrays with exclusively non-negative integers. When enabled, the compressed arrays may be reordered.



38
39
40
# File 'lib/algolia/models/search/index_settings.rb', line 38

def allow_compression_of_integer_array
  @allow_compression_of_integer_array
end

#allow_typos_on_numeric_tokensObject

Whether to allow typos on numbers ("numeric tokens") in the query string.



103
104
105
# File 'lib/algolia/models/search/index_settings.rb', line 103

def allow_typos_on_numeric_tokens
  @allow_typos_on_numeric_tokens
end

#alternatives_as_exactObject



147
148
149
# File 'lib/algolia/models/search/index_settings.rb', line 147

def alternatives_as_exact
  @alternatives_as_exact
end

#attribute_criteria_computed_by_min_proximityObject

When the [Attribute criterion is ranked above Proximity](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.



173
174
175
# File 'lib/algolia/models/search/index_settings.rb', line 173

def attribute_criteria_computed_by_min_proximity
  @attribute_criteria_computed_by_min_proximity
end

#attribute_for_distinctObject

Name of the deduplication attribute to be used with Algolia’s [distinct feature](www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature).



56
57
58
# File 'lib/algolia/models/search/index_settings.rb', line 56

def attribute_for_distinct
  @attribute_for_distinct
end

#attributes_for_facetingObject

Attributes used for [faceting](www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: ‘filterOnly`, `searchable`, and `afterDistinct`.



59
60
61
# File 'lib/algolia/models/search/index_settings.rb', line 59

def attributes_for_faceting
  @attributes_for_faceting
end

#attributes_to_highlightObject

Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (‘highlightPreTag` and `highlightPostTag`).



74
75
76
# File 'lib/algolia/models/search/index_settings.rb', line 74

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. By default, the response includes all attributes.



62
63
64
# File 'lib/algolia/models/search/index_settings.rb', line 62

def attributes_to_retrieve
  @attributes_to_retrieve
end

#attributes_to_snippetObject

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



77
78
79
# File 'lib/algolia/models/search/index_settings.rb', line 77

def attributes_to_snippet
  @attributes_to_snippet
end

#attributes_to_transliterateObject

Attributes in your index to which [Japanese transliteration](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead) applies. This will ensure that words indexed in Katakana or Kanji can also be searched in Hiragana.



23
24
25
# File 'lib/algolia/models/search/index_settings.rb', line 23

def attributes_to_transliterate
  @attributes_to_transliterate
end

#camel_case_attributesObject

Attributes on which to split [camel case](wikipedia.org/wiki/Camel_case) words.



26
27
28
# File 'lib/algolia/models/search/index_settings.rb', line 26

def camel_case_attributes
  @camel_case_attributes
end

#custom_normalizationObject

A list of characters and their normalized replacements to override Algolia’s default [normalization](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/).



53
54
55
# File 'lib/algolia/models/search/index_settings.rb', line 53

def custom_normalization
  @custom_normalization
end

#custom_rankingObject

Specifies the [Custom ranking criterion](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.



68
69
70
# File 'lib/algolia/models/search/index_settings.rb', line 68

def custom_ranking
  @custom_ranking
end

#decompound_queryObject



119
120
121
# File 'lib/algolia/models/search/index_settings.rb', line 119

def decompound_query
  @decompound_query
end

#decompounded_attributesObject



29
30
31
# File 'lib/algolia/models/search/index_settings.rb', line 29

def decompounded_attributes
  @decompounded_attributes
end

#disable_exact_on_attributesObject



142
143
144
# File 'lib/algolia/models/search/index_settings.rb', line 142

def disable_exact_on_attributes
  @disable_exact_on_attributes
end

#disable_prefix_on_attributesObject



35
36
37
# File 'lib/algolia/models/search/index_settings.rb', line 35

def disable_prefix_on_attributes
  @disable_prefix_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/).



106
107
108
# File 'lib/algolia/models/search/index_settings.rb', line 106

def disable_typo_tolerance_on_attributes
  @disable_typo_tolerance_on_attributes
end

#disable_typo_tolerance_on_wordsObject

Words for which you want to turn off [typo tolerance](www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).



20
21
22
# File 'lib/algolia/models/search/index_settings.rb', line 20

def disable_typo_tolerance_on_words
  @disable_typo_tolerance_on_words
end

#distinctObject

Returns the value of attribute distinct.



152
153
154
# File 'lib/algolia/models/search/index_settings.rb', line 152

def distinct
  @distinct
end

#enable_personalizationObject

Incidates whether [Personalization](www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled.



125
126
127
# File 'lib/algolia/models/search/index_settings.rb', line 125

def enable_personalization
  @enable_personalization
end

#enable_re_rankingObject

Indicates whether this search will use [Dynamic Re-Ranking](www.algolia.com/doc/guides/algolia-ai/re-ranking/).



178
179
180
# File 'lib/algolia/models/search/index_settings.rb', line 178

def enable_re_ranking
  @enable_re_ranking
end

#enable_rulesObject

Incidates whether [Rules](www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled.



122
123
124
# File 'lib/algolia/models/search/index_settings.rb', line 122

def enable_rules
  @enable_rules
end

#exact_on_single_word_queryObject

Returns the value of attribute exact_on_single_word_query.



144
145
146
# File 'lib/algolia/models/search/index_settings.rb', line 144

def exact_on_single_word_query
  @exact_on_single_word_query
end

#highlight_post_tagObject

HTML string to insert after the highlighted parts in all highlight and snippet results.



83
84
85
# File 'lib/algolia/models/search/index_settings.rb', line 83

def 
  @highlight_post_tag
end

#highlight_pre_tagObject

HTML string to insert before the highlighted parts in all highlight and snippet results.



80
81
82
# File 'lib/algolia/models/search/index_settings.rb', line 80

def highlight_pre_tag
  @highlight_pre_tag
end

#hits_per_pageObject

Number of hits per page.



92
93
94
# File 'lib/algolia/models/search/index_settings.rb', line 92

def hits_per_page
  @hits_per_page
end

#ignore_pluralsObject

Returns the value of attribute ignore_plurals.



108
109
110
# File 'lib/algolia/models/search/index_settings.rb', line 108

def ignore_plurals
  @ignore_plurals
end

#index_languagesObject



32
33
34
# File 'lib/algolia/models/search/index_settings.rb', line 32

def index_languages
  @index_languages
end

#keep_diacritics_on_charactersObject



113
114
115
# File 'lib/algolia/models/search/index_settings.rb', line 113

def keep_diacritics_on_characters
  @keep_diacritics_on_characters
end

#max_facet_hitsObject

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



164
165
166
# File 'lib/algolia/models/search/index_settings.rb', line 164

def max_facet_hits
  @max_facet_hits
end

#max_values_per_facetObject

Maximum number of facet values to return for each facet.



167
168
169
# File 'lib/algolia/models/search/index_settings.rb', line 167

def max_values_per_facet
  @max_values_per_facet
end

#min_proximityObject



158
159
160
# File 'lib/algolia/models/search/index_settings.rb', line 158

def min_proximity
  @min_proximity
end

#min_word_sizefor1_typoObject

Minimum number of characters a word in the query string 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).



95
96
97
# File 'lib/algolia/models/search/index_settings.rb', line 95

def min_word_sizefor1_typo
  @min_word_sizefor1_typo
end

#min_word_sizefor2_typosObject

Minimum number of characters a word in the query string 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).



98
99
100
# File 'lib/algolia/models/search/index_settings.rb', line 98

def min_word_sizefor2_typos
  @min_word_sizefor2_typos
end

#modeObject

Returns the value of attribute mode.



131
132
133
# File 'lib/algolia/models/search/index_settings.rb', line 131

def mode
  @mode
end

#numeric_attributes_for_filteringObject



41
42
43
# File 'lib/algolia/models/search/index_settings.rb', line 41

def numeric_attributes_for_filtering
  @numeric_attributes_for_filtering
end

#optional_wordsObject



139
140
141
# File 'lib/algolia/models/search/index_settings.rb', line 139

def optional_words
  @optional_words
end

#pagination_limited_toObject

Maximum number of hits accessible through pagination.



14
15
16
# File 'lib/algolia/models/search/index_settings.rb', line 14

def pagination_limited_to
  @pagination_limited_to
end

#query_languagesObject

Sets your user’s search language. This adjusts language-specific settings and features such as ‘ignorePlurals`, `removeStopWords`, and [CJK](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.



116
117
118
# File 'lib/algolia/models/search/index_settings.rb', line 116

def query_languages
  @query_languages
end

#query_typeObject

Returns the value of attribute query_type.



127
128
129
# File 'lib/algolia/models/search/index_settings.rb', line 127

def query_type
  @query_type
end

#rankingObject

Determines the order in which Algolia [returns your results](www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).



65
66
67
# File 'lib/algolia/models/search/index_settings.rb', line 65

def ranking
  @ranking
end

#re_ranking_apply_filterObject

Returns the value of attribute re_ranking_apply_filter.



180
181
182
# File 'lib/algolia/models/search/index_settings.rb', line 180

def re_ranking_apply_filter
  @re_ranking_apply_filter
end

#relevancy_strictnessObject

Relevancy threshold below which less relevant results aren’t included in the results.



71
72
73
# File 'lib/algolia/models/search/index_settings.rb', line 71

def relevancy_strictness
  @relevancy_strictness
end

#remove_stop_wordsObject

Returns the value of attribute remove_stop_words.



110
111
112
# File 'lib/algolia/models/search/index_settings.rb', line 110

def remove_stop_words
  @remove_stop_words
end

#remove_words_if_no_resultsObject

Returns the value of attribute remove_words_if_no_results.



129
130
131
# File 'lib/algolia/models/search/index_settings.rb', line 129

def remove_words_if_no_results
  @remove_words_if_no_results
end

#rendering_contentObject

Returns the value of attribute rendering_content.



175
176
177
# File 'lib/algolia/models/search/index_settings.rb', line 175

def rendering_content
  @rendering_content
end

#replace_synonyms_in_highlightObject

Whether to highlight and snippet the original word that matches the synonym or the synonym itself.



155
156
157
# File 'lib/algolia/models/search/index_settings.rb', line 155

def replace_synonyms_in_highlight
  @replace_synonyms_in_highlight
end

#replicasObject

Creates [replicas](www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/), which are copies of a primary index with the same records but different settings.



11
12
13
# File 'lib/algolia/models/search/index_settings.rb', line 11

def replicas
  @replicas
end

#response_fieldsObject

Attributes to include in the API response for search and browse queries.



161
162
163
# File 'lib/algolia/models/search/index_settings.rb', line 161

def response_fields
  @response_fields
end

#restrict_highlight_and_snippet_arraysObject

Restrict highlighting and snippeting to items that matched the query.



89
90
91
# File 'lib/algolia/models/search/index_settings.rb', line 89

def restrict_highlight_and_snippet_arrays
  @restrict_highlight_and_snippet_arrays
end

#searchable_attributesObject



47
48
49
# File 'lib/algolia/models/search/index_settings.rb', line 47

def searchable_attributes
  @searchable_attributes
end

#semantic_searchObject

Returns the value of attribute semantic_search.



133
134
135
# File 'lib/algolia/models/search/index_settings.rb', line 133

def semantic_search
  @semantic_search
end

#separators_to_indexObject

Controls which separators are added to an Algolia index as part of [normalization](www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean). Separators are all non-letter characters except spaces and currency characters, such as $€£¥.



44
45
46
# File 'lib/algolia/models/search/index_settings.rb', line 44

def separators_to_index
  @separators_to_index
end

#snippet_ellipsis_textObject

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



86
87
88
# File 'lib/algolia/models/search/index_settings.rb', line 86

def snippet_ellipsis_text
  @snippet_ellipsis_text
end

#sort_facet_values_byObject

Controls how facet values are fetched.



170
171
172
# File 'lib/algolia/models/search/index_settings.rb', line 170

def sort_facet_values_by
  @sort_facet_values_by
end

#typo_toleranceObject

Returns the value of attribute typo_tolerance.



100
101
102
# File 'lib/algolia/models/search/index_settings.rb', line 100

def typo_tolerance
  @typo_tolerance
end

#unretrievable_attributesObject

Attributes that can’t be retrieved at query time.



17
18
19
# File 'lib/algolia/models/search/index_settings.rb', line 17

def unretrievable_attributes
  @unretrievable_attributes
end

#user_dataObject

Lets you store custom data in your indices.



50
51
52
# File 'lib/algolia/models/search/index_settings.rb', line 50

def user_data
  @user_data
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



826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
# File 'lib/algolia/models/search/index_settings.rb', line 826

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

.acceptable_attributesObject

Returns all the JSON keys this model knows about



272
273
274
# File 'lib/algolia/models/search/index_settings.rb', line 272

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/algolia/models/search/index_settings.rb', line 205

def self.attribute_map
  {
    :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_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
  }
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



801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
# File 'lib/algolia/models/search/index_settings.rb', line 801

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

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



351
352
353
354
355
356
# File 'lib/algolia/models/search/index_settings.rb', line 351

def self.openapi_all_of
  [
    :BaseIndexSettings,
    :IndexSettingsAsSearchParams
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



344
345
346
347
348
# File 'lib/algolia/models/search/index_settings.rb', line 344

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

.types_mappingObject

Attribute type mapping.



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
# File 'lib/algolia/models/search/index_settings.rb', line 277

def self.types_mapping
  {
    :replicas => :'Array<String>',
    :pagination_limited_to => :Integer,
    :unretrievable_attributes => :'Array<String>',
    :disable_typo_tolerance_on_words => :'Array<String>',
    :attributes_to_transliterate => :'Array<String>',
    :camel_case_attributes => :'Array<String>',
    :decompounded_attributes => :Object,
    :index_languages => :'Array<String>',
    :disable_prefix_on_attributes => :'Array<String>',
    :allow_compression_of_integer_array => :Boolean,
    :numeric_attributes_for_filtering => :'Array<String>',
    :separators_to_index => :String,
    :searchable_attributes => :'Array<String>',
    :user_data => :Object,
    :custom_normalization => :'Hash<String, Hash<String, String>>',
    :attribute_for_distinct => :String,
    :attributes_for_faceting => :'Array<String>',
    :attributes_to_retrieve => :'Array<String>',
    :ranking => :'Array<String>',
    :custom_ranking => :'Array<String>',
    :relevancy_strictness => :Integer,
    :attributes_to_highlight => :'Array<String>',
    :attributes_to_snippet => :'Array<String>',
    :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<String>',
    :ignore_plurals => :IgnorePlurals,
    :remove_stop_words => :RemoveStopWords,
    :keep_diacritics_on_characters => :String,
    :query_languages => :'Array<String>',
    :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<String>',
    :disable_exact_on_attributes => :'Array<String>',
    :exact_on_single_word_query => :ExactOnSingleWordQuery,
    :alternatives_as_exact => :'Array<AlternativesAsExact>',
    :advanced_syntax_features => :'Array<AdvancedSyntaxFeatures>',
    :distinct => :Distinct,
    :replace_synonyms_in_highlight => :Boolean,
    :min_proximity => :Integer,
    :response_fields => :'Array<String>',
    :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

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/algolia/models/search/index_settings.rb', line 718

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    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_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 &&
     == other. &&
    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

#_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



897
898
899
900
901
902
903
904
905
906
907
908
909
# File 'lib/algolia/models/search/index_settings.rb', line 897

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


787
788
789
# File 'lib/algolia/models/search/index_settings.rb', line 787

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



793
794
795
796
# File 'lib/algolia/models/search/index_settings.rb', line 793

def hash
  [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_for_faceting, attributes_to_retrieve, ranking, custom_ranking, relevancy_strictness, attributes_to_highlight, attributes_to_snippet, highlight_pre_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

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



873
874
875
# File 'lib/algolia/models/search/index_settings.rb', line 873

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



879
880
881
882
883
884
885
886
887
888
889
890
891
# File 'lib/algolia/models/search/index_settings.rb', line 879

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



867
868
869
# File 'lib/algolia/models/search/index_settings.rb', line 867

def to_s
  to_hash.to_s
end