diff --git a/CHANGELOG.md b/CHANGELOG.md index 663257f..678f0b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ - Raise error when `search` called on relations - Raise `ArgumentError` (instead of warning) for invalid regular expression modifiers - Raise `ArgumentError` instead of `RuntimeError` for unknown operators +- Updated `searchkick_index_options` to return symbol keys (instead of mix of strings and symbols) +- Fixed issue with `merge_mappings` - Removed mapping of `id` to `_id` with `order` option - Removed `wordnet` option - Removed `elasticsearch` dependency diff --git a/lib/searchkick/index_options.rb b/lib/searchkick/index_options.rb index f949659..2153c2a 100644 --- a/lib/searchkick/index_options.rb +++ b/lib/searchkick/index_options.rb @@ -7,14 +7,16 @@ module Searchkick end def index_options - custom_mapping = options[:mappings] || {} + # 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 = options[:settings] || {} - mappings = custom_mapping + settings = custom_settings + mappings = custom_mappings else - settings = generate_settings - mappings = generate_mappings.symbolize_keys.deep_merge(custom_mapping.symbolize_keys) + 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] @@ -182,9 +184,6 @@ module Searchkick end end - # merge settings option last - settings = settings.symbolize_keys.deep_merge((options[:settings] || {}).symbolize_keys) - settings end @@ -367,7 +366,7 @@ module Searchkick mapping_options[:searchable].delete("_all") - analyzed_field_options = {type: default_type, index: true, analyzer: default_analyzer} + analyzed_field_options = {type: default_type, index: true, analyzer: default_analyzer.to_s} mapping_options.values.flatten.uniq.each do |field| fields = {} -- libgit2 0.21.0