Commit 5dcd481c35f7678847eb7a4cfc8fc139ed5e5be9

Authored by Andrew Kane
1 parent 2a1f344e

Added support for nori analyzer - fixes #1337

CHANGELOG.md
1 1 ## 4.1.1 [unreleased]
2 2  
  3 +- Added `korean2` language
3 4 - Improved performance of async full reindex
4 5  
5 6 ## 4.1.0
... ...
README.md
... ... @@ -318,6 +318,7 @@ A few languages require plugins:
318 318 - `chinese` - [analysis-ik plugin](https://github.com/medcl/elasticsearch-analysis-ik)
319 319 - `japanese` - [analysis-kuromoji plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-kuromoji.html)
320 320 - `korean` - [analysis-openkoreantext plugin](https://github.com/open-korean-text/elasticsearch-analysis-openkoreantext)
  321 +- `korean2` - [analysis-nori plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/7.4/analysis-nori.html)
321 322 - `polish` - [analysis-stempel plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-stempel.html)
322 323 - `ukrainian` - [analysis-ukrainian plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-ukrainian.html)
323 324 - `vietnamese` - [analysis-vietnamese plugin](https://github.com/duydo/elasticsearch-analysis-vietnamese)
... ...
lib/searchkick/index_options.rb
... ... @@ -197,6 +197,20 @@ module Searchkick
197 197 )
198 198  
199 199 stem = false
  200 + when "korean2"
  201 + settings[:analysis][:analyzer].merge!(
  202 + default_analyzer => {
  203 + type: "nori"
  204 + },
  205 + searchkick_search: {
  206 + type: "nori"
  207 + },
  208 + searchkick_search2: {
  209 + type: "nori"
  210 + }
  211 + )
  212 +
  213 + stem = false
200 214 when "vietnamese"
201 215 settings[:analysis][:analyzer].merge!(
202 216 default_analyzer => {
... ...
test/language_test.rb
... ... @@ -48,6 +48,16 @@ class LanguageTest < Minitest::Test
48 48 end
49 49 end
50 50  
  51 + def test_korean2
  52 + # requires https://www.elastic.co/guide/en/elasticsearch/plugins/7.4/analysis-nori.html
  53 + with_options(Song, language: "korean2") do
  54 + store_names ["한국어를 처리하는 예시입니닼ㅋㅋ"], Song
  55 + assert_language_search "처리", ["한국어를 처리하는 예시입니닼ㅋㅋ"]
  56 + assert_language_search "한국어", ["한국어를 처리하는 예시입니닼ㅋㅋ"]
  57 + assert_language_search "를", []
  58 + end
  59 + end
  60 +
51 61 def test_polish
52 62 # requires https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-stempel.html
53 63 with_options(Song, language: "polish") do
... ...