From 682b0878fe8a7b50b997b2f86f787f1f72fe94c5 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Thu, 18 Jun 2020 05:29:12 -0700 Subject: [PATCH] Moved index type to method --- lib/searchkick/index_options.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/searchkick/index_options.rb b/lib/searchkick/index_options.rb index ba57aec..1d5ddcb 100644 --- a/lib/searchkick/index_options.rb +++ b/lib/searchkick/index_options.rb @@ -7,11 +7,6 @@ module Searchkick end def index_options - if below70 - index_type = options[:_type] - index_type = index_type.call if index_type.respond_to?(:call) - end - custom_mapping = options[:mappings] || {} if below70 && custom_mapping.keys.map(&:to_sym).include?(:properties) # add type @@ -504,6 +499,14 @@ module Searchkick end end + def index_type + @index_type ||= begin + index_type = options[:_type] + index_type = index_type.call if index_type.respond_to?(:call) + index_type + end + end + def default_type "text" end -- libgit2 0.21.0