Commit 289d99187df5fc238e5b5a40e9a89d895a8f7365

Authored by Andrew
1 parent 211624e3

Symbolize keys for better merging - fixes #1144

lib/searchkick/index_options.rb
@@ -225,7 +225,7 @@ module Searchkick @@ -225,7 +225,7 @@ module Searchkick
225 } 225 }
226 end 226 end
227 227
228 - settings.deep_merge!(options[:settings] || {}) 228 + settings = settings.symbolize_keys.deep_merge((options[:settings] || {}).symbolize_keys)
229 229
230 # synonyms 230 # synonyms
231 synonyms = options[:synonyms] || [] 231 synonyms = options[:synonyms] || []
@@ -311,10 +311,10 @@ module Searchkick @@ -311,10 +311,10 @@ module Searchkick
311 311
312 if !options[:searchable] || mapping_options[:searchable].include?(field) 312 if !options[:searchable] || mapping_options[:searchable].include?(field)
313 if word 313 if word
314 - fields["analyzed"] = analyzed_field_options 314 + fields[:analyzed] = analyzed_field_options
315 315
316 if mapping_options[:highlight].include?(field) 316 if mapping_options[:highlight].include?(field)
317 - fields["analyzed"][:term_vector] = "with_positions_offsets" 317 + fields[:analyzed][:term_vector] = "with_positions_offsets"
318 end 318 end
319 end 319 end
320 320
@@ -373,7 +373,7 @@ module Searchkick @@ -373,7 +373,7 @@ module Searchkick
373 end 373 end
374 374
375 if word 375 if word
376 - dynamic_fields["analyzed"] = analyzed_field_options 376 + dynamic_fields[:analyzed] = analyzed_field_options
377 end 377 end
378 end 378 end
379 379
@@ -402,7 +402,7 @@ module Searchkick @@ -402,7 +402,7 @@ module Searchkick
402 mappings[index_type][:_all] = all_enabled ? analyzed_field_options : {enabled: false} 402 mappings[index_type][:_all] = all_enabled ? analyzed_field_options : {enabled: false}
403 end 403 end
404 404
405 - mappings = mappings.deep_merge(options[:mappings] || {}) 405 + mappings = mappings.symbolize_keys.deep_merge((options[:mappings] || {}).symbolize_keys)
406 end 406 end
407 407
408 { 408 {
test/routing_test.rb
@@ -8,7 +8,7 @@ class RoutingTest < Minitest::Test @@ -8,7 +8,7 @@ class RoutingTest < Minitest::Test
8 8
9 def test_routing_mappings 9 def test_routing_mappings
10 index_options = Store.searchkick_index.index_options 10 index_options = Store.searchkick_index.index_options
11 - assert_equal index_options[:mappings]["store"][:_routing], required: true 11 + assert_equal index_options[:mappings][:store][:_routing], required: true
12 end 12 end
13 13
14 def test_routing_correct_node 14 def test_routing_correct_node