Commit 67f40267355e600de27eeb1a1107add610f17733

Authored by Andrew
1 parent e71a3cbe

Added support for Korean [skip ci]

CHANGELOG.md
1 1 ## 3.0.2 [unreleased]
2 2  
  3 +- Added support for Korean
3 4 - Fixed `Unsupported argument type: Symbol` for async partial reindex
4 5 - Fixed infinite recursion with multi search and misspellings below
5 6 - Do not raise an error when `id` is indexed
... ...
README.md
... ... @@ -304,6 +304,7 @@ A few languages require plugins:
304 304  
305 305 - `chinese` - [elasticsearch-analysis-ik plugin](https://github.com/medcl/elasticsearch-analysis-ik)
306 306 - `japanese` - [analysis-kuromoji plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-kuromoji.html)
  307 +- `korean` - [elasticsearch-analysis-openkoreantext](https://github.com/open-korean-text/elasticsearch-analysis-openkoreantext) [master]
307 308 - `polish` - [analysis-stempel plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-stempel.html)
308 309 - `ukrainian` - [analysis-ukrainian plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-ukrainian.html)
309 310  
... ...
lib/searchkick/index_options.rb
... ... @@ -169,6 +169,18 @@ module Searchkick
169 169 type: "kuromoji"
170 170 }
171 171 )
  172 + when "korean"
  173 + settings[:analysis][:analyzer].merge!(
  174 + default_analyzer => {
  175 + type: "openkoreantext-analyzer"
  176 + },
  177 + searchkick_search: {
  178 + type: "openkoreantext-analyzer"
  179 + },
  180 + searchkick_search2: {
  181 + type: "openkoreantext-analyzer"
  182 + }
  183 + )
172 184 when "polish", "ukrainian", "smartcn"
173 185 settings[:analysis][:analyzer].merge!(
174 186 default_analyzer => {
... ...
lib/searchkick/query.rb
... ... @@ -317,7 +317,7 @@ module Searchkick
317 317 qs << shared_options.merge(analyzer: "searchkick_search")
318 318  
319 319 # searchkick_search and searchkick_search2 are the same for ukrainian
320   - unless %w(japanese polish ukrainian).include?(searchkick_options[:language])
  320 + unless %w(japanese korean polish ukrainian).include?(searchkick_options[:language])
321 321 qs << shared_options.merge(analyzer: "searchkick_search2")
322 322 end
323 323 exclude_analyzer = "searchkick_search2"
... ...
test/language_test.rb
... ... @@ -38,6 +38,16 @@ class LanguageTest &lt; Minitest::Test
38 38 end
39 39 end
40 40  
  41 + def test_korean
  42 + # requires https://github.com/open-korean-text/elasticsearch-analysis-openkoreantext
  43 + with_options(Song, language: "korean") do
  44 + store_names ["한국어를 처리하는 예시입니닼ㅋㅋ"], Song
  45 + assert_language_search "처리", ["한국어를 처리하는 예시입니닼ㅋㅋ"]
  46 + assert_language_search "한국어", ["한국어를 처리하는 예시입니닼ㅋㅋ"]
  47 + assert_language_search "를", []
  48 + end
  49 + end
  50 +
41 51 def test_polish
42 52 # requires https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-stempel.html
43 53 with_options(Song, language: "polish") do
... ...