Commit 3e3dc3aa625f7d45eabd2d039fd3b53ee6be9f03
1 parent
16243ac4
Exists in
master
and in
18 other branches
Added experimental support for smartcn [skip ci]
Showing
2 changed files
with
15 additions
and
16 deletions
Show diff stats
lib/searchkick/index_options.rb
... | ... | @@ -169,28 +169,16 @@ module Searchkick |
169 | 169 | type: "kuromoji" |
170 | 170 | } |
171 | 171 | ) |
172 | - when "polish" | |
172 | + when "polish", "ukrainian", "smartcn" | |
173 | 173 | settings[:analysis][:analyzer].merge!( |
174 | 174 | default_analyzer => { |
175 | - type: "polish" | |
175 | + type: language | |
176 | 176 | }, |
177 | 177 | searchkick_search: { |
178 | - type: "polish" | |
178 | + type: language | |
179 | 179 | }, |
180 | 180 | searchkick_search2: { |
181 | - type: "polish" | |
182 | - } | |
183 | - ) | |
184 | - when "ukrainian" | |
185 | - settings[:analysis][:analyzer].merge!( | |
186 | - default_analyzer => { | |
187 | - type: "ukrainian" | |
188 | - }, | |
189 | - searchkick_search: { | |
190 | - type: "ukrainian" | |
191 | - }, | |
192 | - searchkick_search2: { | |
193 | - type: "ukrainian" | |
181 | + type: language | |
194 | 182 | } |
195 | 183 | ) |
196 | 184 | end | ... | ... |
test/language_test.rb
... | ... | @@ -17,6 +17,17 @@ class LanguageTest < Minitest::Test |
17 | 17 | end |
18 | 18 | end |
19 | 19 | |
20 | + # experimental | |
21 | + def test_smartcn | |
22 | + # requires https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-smartcn.html | |
23 | + with_options(Song, language: "smartcn") do | |
24 | + store_names ["中华人民共和国国歌"], Song | |
25 | + assert_language_search "中华人民共和国", ["中华人民共和国国歌"] | |
26 | + # assert_language_search "国歌", ["中华人民共和国国歌"] | |
27 | + assert_language_search "人", [] | |
28 | + end | |
29 | + end | |
30 | + | |
20 | 31 | def test_japanese |
21 | 32 | # requires https://www.elastic.co/guide/en/elasticsearch/plugins/6.2/analysis-kuromoji.html |
22 | 33 | with_options(Song, language: "japanese") do | ... | ... |