Commit ceabee16 authored by Takeshi Umeda's avatar Takeshi Umeda
Browse files

Set up elasticsearch 7 to use sudachi

parent 3de2c379
...@@ -33,7 +33,7 @@ gem 'bootsnap', '~> 1.4', require: false ...@@ -33,7 +33,7 @@ gem 'bootsnap', '~> 1.4', require: false
gem 'browser' gem 'browser'
gem 'charlock_holmes', '~> 0.7.7' gem 'charlock_holmes', '~> 0.7.7'
gem 'iso-639' gem 'iso-639'
gem 'chewy', '~> 5.1' gem 'chewy', git: 'https://github.com/noellabo/chewy.git', ref: 'bce53720beaab36d0cb8cfbd0bc98fb0e44ddaf0'
gem 'cld3', '~> 3.2.6' gem 'cld3', '~> 3.2.6'
gem 'devise', '~> 4.7' gem 'devise', '~> 4.7'
gem 'devise-two-factor', '~> 3.1' gem 'devise-two-factor', '~> 3.1'
......
...@@ -6,6 +6,17 @@ GIT ...@@ -6,6 +6,17 @@ GIT
health_check (4.0.0.pre) health_check (4.0.0.pre)
rails (>= 4.0) rails (>= 4.0)
GIT
remote: https://github.com/noellabo/chewy.git
revision: bce53720beaab36d0cb8cfbd0bc98fb0e44ddaf0
ref: bce53720beaab36d0cb8cfbd0bc98fb0e44ddaf0
specs:
chewy (5.1.0)
activesupport (>= 4.0)
elasticsearch (>= 7.0.0)
elasticsearch-dsl
faraday (>= 0.17.0)
GIT GIT
remote: https://github.com/rtomayko/posix-spawn remote: https://github.com/rtomayko/posix-spawn
revision: 58465d2e213991f8afb13b984854a49fcdcc980c revision: 58465d2e213991f8afb13b984854a49fcdcc980c
...@@ -155,10 +166,6 @@ GEM ...@@ -155,10 +166,6 @@ GEM
case_transform (0.2) case_transform (0.2)
activesupport activesupport
charlock_holmes (0.7.7) charlock_holmes (0.7.7)
chewy (5.1.0)
activesupport (>= 4.0)
elasticsearch (>= 2.0.0)
elasticsearch-dsl
chunky_png (1.3.11) chunky_png (1.3.11)
cld3 (3.2.6) cld3 (3.2.6)
ffi (>= 1.1.0, < 1.12.0) ffi (>= 1.1.0, < 1.12.0)
...@@ -682,7 +689,7 @@ DEPENDENCIES ...@@ -682,7 +689,7 @@ DEPENDENCIES
capistrano-yarn (~> 2.0) capistrano-yarn (~> 2.0)
capybara (~> 3.30) capybara (~> 3.30)
charlock_holmes (~> 0.7.7) charlock_holmes (~> 0.7.7)
chewy (~> 5.1) chewy!
cld3 (~> 3.2.6) cld3 (~> 3.2.6)
climate_control (~> 0.2) climate_control (~> 0.2)
concurrent-ruby concurrent-ruby
......
...@@ -2,31 +2,26 @@ ...@@ -2,31 +2,26 @@
class StatusesIndex < Chewy::Index class StatusesIndex < Chewy::Index
settings index: { refresh_interval: '15m' }, analysis: { settings index: { refresh_interval: '15m' }, analysis: {
filter: { tokenizer: {
english_stop: { sudachi_tokenizer: {
type: 'stop', type: 'sudachi_tokenizer',
stopwords: '_english_', mode: 'search',
}, discard_punctuation: true,
english_stemmer: { resources_path: '/etc/elasticsearch',
type: 'stemmer', settings_path: '/etc/elasticsearch/sudachi.json',
language: 'english',
},
english_possessive_stemmer: {
type: 'stemmer',
language: 'possessive_english',
}, },
}, },
analyzer: { analyzer: {
content: { content: {
tokenizer: 'uax_url_email',
filter: %w( filter: %w(
english_possessive_stemmer
lowercase lowercase
asciifolding
cjk_width cjk_width
english_stop sudachi_part_of_speech
english_stemmer sudachi_ja_stop
sudachi_baseform
), ),
tokenizer: 'sudachi_tokenizer',
type: 'custom',
}, },
}, },
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment