Permalink
Browse files

Fixed error with more language stemmers and Elasticsearch 6.5

  • Loading branch information...
ankane committed Dec 17, 2018
1 parent e3706c8 commit e3a55de15af55dbc59fa91440d5f521b13560864
Showing with 14 additions and 5 deletions.
  1. +1 −1 CHANGELOG.md
  2. +13 −4 lib/searchkick/index_options.rb
@@ -1,7 +1,7 @@
## 3.1.3 [unreleased]

- Added `prefix` to `where`
- Fixed error with Japanese stemmer and Elasticsearch 6.5
- Fixed error with language stemmers and Elasticsearch 6.5

## 3.1.2

@@ -153,6 +153,8 @@ def index_options
end
end

stem = options[:stem]

case language
when "chinese"
settings[:analysis][:analyzer].merge!(
@@ -167,7 +169,7 @@ def index_options
}
)

settings[:analysis][:filter].delete(:searchkick_stemmer)
stem = false
when "japanese"
settings[:analysis][:analyzer].merge!(
default_analyzer => {
@@ -181,7 +183,7 @@ def index_options
}
)

settings[:analysis][:filter].delete(:searchkick_stemmer)
stem = false
when "korean"
settings[:analysis][:analyzer].merge!(
default_analyzer => {
@@ -194,6 +196,8 @@ def index_options
type: "openkoreantext-analyzer"
}
)

stem = false
when "vietnamese"
settings[:analysis][:analyzer].merge!(
default_analyzer => {
@@ -206,6 +210,8 @@ def index_options
type: "vi_analyzer"
}
)

stem = false
when "polish", "ukrainian", "smartcn"
settings[:analysis][:analyzer].merge!(
default_analyzer => {
@@ -218,6 +224,8 @@ def index_options
type: language
}
)

stem = false
end

if Searchkick.env == "test"
@@ -242,9 +250,10 @@ def index_options
end
end

if options[:stem] == false
if stem == false
settings[:analysis][:filter].delete(:searchkick_stemmer)
settings[:analysis][:analyzer].each do |_, analyzer|
analyzer[:filter].delete("searchkick_stemmer")
analyzer[:filter].delete("searchkick_stemmer") if analyzer[:filter]
end
end

0 comments on commit e3a55de

Please sign in to comment.