Commit e3b31424d8d5ba21d18a1c930bd0d799de52cd7f

Authored by Andrew Kane
1 parent f81007a4

Improved index options code [skip ci]

Showing 1 changed file with 5 additions and 8 deletions   Show diff stats
lib/searchkick/index_options.rb
... ... @@ -27,9 +27,6 @@ module Searchkick
27 27 default_analyzer = :searchkick_index
28 28 keyword_mapping = {type: "keyword"}
29 29  
30   - index_true_value = true
31   - index_false_value = false
32   -
33 30 keyword_mapping[:ignore_above] = options[:ignore_above] || 30000
34 31  
35 32 settings = {
... ... @@ -356,13 +353,13 @@ module Searchkick
356 353  
357 354 mapping_options[:searchable].delete("_all")
358 355  
359   - analyzed_field_options = {type: default_type, index: index_true_value, analyzer: default_analyzer}
  356 + analyzed_field_options = {type: default_type, index: true, analyzer: default_analyzer}
360 357  
361 358 mapping_options.values.flatten.uniq.each do |field|
362 359 fields = {}
363 360  
364 361 if options.key?(:filterable) && !mapping_options[:filterable].include?(field)
365   - fields[field] = {type: default_type, index: index_false_value}
  362 + fields[field] = {type: default_type, index: false}
366 363 else
367 364 fields[field] = keyword_mapping
368 365 end
... ... @@ -378,7 +375,7 @@ module Searchkick
378 375  
379 376 mapping_options.except(:highlight, :searchable, :filterable, :word).each do |type, f|
380 377 if options[:match] == type || f.include?(field)
381   - fields[type] = {type: default_type, index: index_true_value, analyzer: "searchkick_#{type}_index"}
  378 + fields[type] = {type: default_type, index: true, analyzer: "searchkick_#{type}_index"}
382 379 end
383 380 end
384 381 end
... ... @@ -418,12 +415,12 @@ module Searchkick
418 415 }
419 416  
420 417 if options.key?(:filterable)
421   - dynamic_fields["{name}"] = {type: default_type, index: index_false_value}
  418 + dynamic_fields["{name}"] = {type: default_type, index: false}
422 419 end
423 420  
424 421 unless options[:searchable]
425 422 if options[:match] && options[:match] != :word
426   - dynamic_fields[options[:match]] = {type: default_type, index: index_true_value, analyzer: "searchkick_#{options[:match]}_index"}
  423 + dynamic_fields[options[:match]] = {type: default_type, index: true, analyzer: "searchkick_#{options[:match]}_index"}
427 424 end
428 425  
429 426 if word
... ...