diff --git a/lib/searchkick/index.rb b/lib/searchkick/index.rb index 6ad2b55..193da2e 100644 --- a/lib/searchkick/index.rb +++ b/lib/searchkick/index.rb @@ -464,10 +464,13 @@ module Searchkick "{name}" => {type: "string", index: "not_analyzed"} } - unless options[:word] == false + if options[:match] && options[:match] != :word + dynamic_fields[options[:match]] = {type: "string", index: "analyzed", analyzer: "searchkick_#{options[:match]}_index"} + elsif options[:word] != false dynamic_fields["analyzed"] = {type: "string", index: "analyzed"} end + mappings = { _default_: { properties: mapping, diff --git a/lib/searchkick/query.rb b/lib/searchkick/query.rb index 2ad311f..c201100 100644 --- a/lib/searchkick/query.rb +++ b/lib/searchkick/query.rb @@ -30,7 +30,7 @@ module Searchkick options[:fields].map { |f| "#{f}.autocomplete" } else options[:fields].map do |value| - k, v = value.is_a?(Hash) ? value.to_a.first : [value, options[:match] || :word] + k, v = value.is_a?(Hash) ? value.to_a.first : [value, options[:match] || searchkick_options[:match] || :word] k2, boost = k.to_s.split("^", 2) field = "#{k2}.#{v == :word ? 'analyzed' : v}" boost_fields[field] = boost.to_f if boost -- libgit2 0.21.0