From 0610b3f58f3235f3d6b707b8e009a0aa1ff53079 Mon Sep 17 00:00:00 2001 From: kedamaDQ Date: Fri, 20 Oct 2023 11:00:38 +0900 Subject: [PATCH] Enabled feature full-text search --- app/chewy/public_statuses_index.rb | 23 ++++++++++++++++++----- app/chewy/statuses_index.rb | 23 ++++++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/app/chewy/public_statuses_index.rb b/app/chewy/public_statuses_index.rb index 4be204d4a9bfd4..d468f5a49c71ed 100644 --- a/app/chewy/public_statuses_index.rb +++ b/app/chewy/public_statuses_index.rb @@ -3,6 +3,11 @@ class PublicStatusesIndex < Chewy::Index settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: { filter: { + kuromoji_search_split: { + type: 'sudachi_split', + mode: 'search', + }, + english_stop: { type: 'stop', stopwords: '_english_', @@ -19,6 +24,14 @@ class PublicStatusesIndex < Chewy::Index }, }, + tokenizer: { + sudachi_tokenizer: { + type: 'sudachi_tokenizer', + discard_punctuation: true, + additional_settings: '{"systemDict": "system_full.dic"}', + }, + }, + analyzer: { verbatim: { tokenizer: 'uax_url_email', @@ -26,15 +39,15 @@ class PublicStatusesIndex < Chewy::Index }, content: { - tokenizer: 'standard', + tokenizer: 'sudachi_tokenizer', filter: %w( lowercase asciifolding cjk_width - elision - english_possessive_stemmer - english_stop - english_stemmer + kuromoji_search_split + sudachi_part_of_speech + sudachi_ja_stop + sudachi_normalizedform ), }, diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb index 6b25dc9dff8d33..0efaf788000540 100644 --- a/app/chewy/statuses_index.rb +++ b/app/chewy/statuses_index.rb @@ -3,6 +3,11 @@ class StatusesIndex < Chewy::Index settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: { filter: { + kuromoji_search_split: { + type: 'sudachi_split', + mode: 'search', + }, + english_stop: { type: 'stop', stopwords: '_english_', @@ -19,6 +24,14 @@ class StatusesIndex < Chewy::Index }, }, + tokenizer: { + sudachi_tokenizer: { + type: 'sudachi_tokenizer', + discard_punctuation: true, + additional_settings: '{"systemDict": "system_full.dic"}', + }, + }, + analyzer: { verbatim: { tokenizer: 'uax_url_email', @@ -26,15 +39,15 @@ class StatusesIndex < Chewy::Index }, content: { - tokenizer: 'standard', + tokenizer: 'sudachi_tokenizer', filter: %w( lowercase asciifolding cjk_width - elision - english_possessive_stemmer - english_stop - english_stemmer + kuromoji_search_split + sudachi_part_of_speech + sudachi_ja_stop + sudachi_normalizedform ), },