lib/searchkick/index_options.rb in searchkick-4.4.2 vs lib/searchkick/index_options.rb in searchkick-4.4.3

- old
+ new

@@ -151,10 +151,11 @@ } } } } + raise ArgumentError, "Can't pass both language and stemmer" if options[:stemmer] && language update_language(settings, language) update_stemming(settings) if Searchkick.env == "test" settings[:number_of_shards] = 1 @@ -284,9 +285,21 @@ ) end end def update_stemming(settings) + if options[:stemmer] + stemmer = options[:stemmer] + # could also support snowball and stemmer + case stemmer[:type] + when "hunspell" + # supports all token filter options + settings[:analysis][:filter][:searchkick_stemmer] = stemmer + else + raise ArgumentError, "Unknown stemmer: #{stemmer[:type]}" + end + end + stem = options[:stem] # language analyzer used stem = false if settings[:analysis][:analyzer][default_analyzer][:type] != "custom"