Commit 682b0878fe8a7b50b997b2f86f787f1f72fe94c5
1 parent
54c48b92
Exists in
master
and in
8 other branches
Moved index type to method
Showing
1 changed file
with
8 additions
and
5 deletions
Show diff stats
lib/searchkick/index_options.rb
... | ... | @@ -7,11 +7,6 @@ module Searchkick |
7 | 7 | end |
8 | 8 | |
9 | 9 | def index_options |
10 | - if below70 | |
11 | - index_type = options[:_type] | |
12 | - index_type = index_type.call if index_type.respond_to?(:call) | |
13 | - end | |
14 | - | |
15 | 10 | custom_mapping = options[:mappings] || {} |
16 | 11 | if below70 && custom_mapping.keys.map(&:to_sym).include?(:properties) |
17 | 12 | # add type |
... | ... | @@ -504,6 +499,14 @@ module Searchkick |
504 | 499 | end |
505 | 500 | end |
506 | 501 | |
502 | + def index_type | |
503 | + @index_type ||= begin | |
504 | + index_type = options[:_type] | |
505 | + index_type = index_type.call if index_type.respond_to?(:call) | |
506 | + index_type | |
507 | + end | |
508 | + end | |
509 | + | |
507 | 510 | def default_type |
508 | 511 | "text" |
509 | 512 | end | ... | ... |