From 40db10417c31e7009d7a27af1cafb06a28c0311d Mon Sep 17 00:00:00 2001 From: noellabo Date: Fri, 28 Jun 2019 05:50:16 +0900 Subject: [PATCH] Set up elasticsearch 7 to use sudachi --- app/chewy/statuses_index.rb | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb index 670e029d8..9f746c4ee 100644 --- a/app/chewy/statuses_index.rb +++ b/app/chewy/statuses_index.rb @@ -2,31 +2,29 @@ class StatusesIndex < Chewy::Index settings index: { refresh_interval: '15m' }, analysis: { - filter: { - english_stop: { - type: 'stop', - stopwords: '_english_', - }, - english_stemmer: { - type: 'stemmer', - language: 'english', - }, - english_possessive_stemmer: { - type: 'stemmer', - language: 'possessive_english', + tokenizer: { + sudachi_tokenizer: { + type: 'sudachi_tokenizer', + discard_punctuation: true, + resources_path: '/etc/elasticsearch', + settings_path: '/etc/elasticsearch/sudachi.json', + additional_settings: { + systemDict: 'system_full.dic', + userDict: [], + }, }, }, analyzer: { content: { - tokenizer: 'uax_url_email', filter: %w( - english_possessive_stemmer lowercase - asciifolding cjk_width - english_stop - english_stemmer + sudachi_part_of_speech + sudachi_ja_stop + sudachi_baseform ), + tokenizer: 'sudachi_tokenizer', + type: 'custom', }, }, }