Method: Searchkick::IndexOptions#index_options

Defined in:
lib/searchkick/index_options.rb

#index_optionsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/searchkick/index_options.rb', line 9

def index_options
  # mortal symbols are garbage collected in Ruby 2.2+
  custom_settings = (options[:settings] || {}).deep_symbolize_keys
  custom_mappings = (options[:mappings] || {}).deep_symbolize_keys

  if options[:mappings] && !options[:merge_mappings]
    settings = custom_settings
    mappings = custom_mappings
  else
    settings = generate_settings.deep_symbolize_keys.deep_merge(custom_settings)
    mappings = generate_mappings.deep_symbolize_keys.deep_merge(custom_mappings)
  end

  set_deep_paging(settings) if options[:deep_paging] || options[:max_result_window]

  {
    settings: settings,
    mappings: mappings
  }
end