Commit e3b31424d8d5ba21d18a1c930bd0d799de52cd7f
1 parent
f81007a4
Exists in
master
and in
9 other branches
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,9 +27,6 @@ module Searchkick | ||
27 | default_analyzer = :searchkick_index | 27 | default_analyzer = :searchkick_index |
28 | keyword_mapping = {type: "keyword"} | 28 | keyword_mapping = {type: "keyword"} |
29 | 29 | ||
30 | - index_true_value = true | ||
31 | - index_false_value = false | ||
32 | - | ||
33 | keyword_mapping[:ignore_above] = options[:ignore_above] || 30000 | 30 | keyword_mapping[:ignore_above] = options[:ignore_above] || 30000 |
34 | 31 | ||
35 | settings = { | 32 | settings = { |
@@ -356,13 +353,13 @@ module Searchkick | @@ -356,13 +353,13 @@ module Searchkick | ||
356 | 353 | ||
357 | mapping_options[:searchable].delete("_all") | 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 | mapping_options.values.flatten.uniq.each do |field| | 358 | mapping_options.values.flatten.uniq.each do |field| |
362 | fields = {} | 359 | fields = {} |
363 | 360 | ||
364 | if options.key?(:filterable) && !mapping_options[:filterable].include?(field) | 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 | else | 363 | else |
367 | fields[field] = keyword_mapping | 364 | fields[field] = keyword_mapping |
368 | end | 365 | end |
@@ -378,7 +375,7 @@ module Searchkick | @@ -378,7 +375,7 @@ module Searchkick | ||
378 | 375 | ||
379 | mapping_options.except(:highlight, :searchable, :filterable, :word).each do |type, f| | 376 | mapping_options.except(:highlight, :searchable, :filterable, :word).each do |type, f| |
380 | if options[:match] == type || f.include?(field) | 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 | end | 379 | end |
383 | end | 380 | end |
384 | end | 381 | end |
@@ -418,12 +415,12 @@ module Searchkick | @@ -418,12 +415,12 @@ module Searchkick | ||
418 | } | 415 | } |
419 | 416 | ||
420 | if options.key?(:filterable) | 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 | end | 419 | end |
423 | 420 | ||
424 | unless options[:searchable] | 421 | unless options[:searchable] |
425 | if options[:match] && options[:match] != :word | 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 | end | 424 | end |
428 | 425 | ||
429 | if word | 426 | if word |