From 741d03144488360ced92dbf7dd9e31303b07ebe5 Mon Sep 17 00:00:00 2001 From: KMY Date: Sun, 10 Sep 2023 17:56:46 +0900 Subject: [PATCH] Fix search tests --- app/chewy/public_statuses_index.rb | 15 ++++++++++++++- app/chewy/statuses_index.rb | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/chewy/public_statuses_index.rb b/app/chewy/public_statuses_index.rb index 4bcbe817d9..d152b52039 100644 --- a/app/chewy/public_statuses_index.rb +++ b/app/chewy/public_statuses_index.rb @@ -38,6 +38,19 @@ class PublicStatusesIndex < Chewy::Index ), }, + sudachi_analyzer: { + tokenizer: 'standard', + filter: %w( + lowercase + asciifolding + cjk_width + elision + english_possessive_stemmer + english_stop + english_stemmer + ), + }, + hashtag: { tokenizer: 'keyword', filter: %w( @@ -126,7 +139,7 @@ class PublicStatusesIndex < Chewy::Index }, }.freeze - settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: PRODUCTION_SETTINGS + settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: Rails.env.test? ? DEVELOPMENT_SETTINGS : PRODUCTION_SETTINGS index_scope ::Status.unscoped .kept diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb index 5c993422de..3b83e2f31c 100644 --- a/app/chewy/statuses_index.rb +++ b/app/chewy/statuses_index.rb @@ -37,6 +37,19 @@ class StatusesIndex < Chewy::Index ), }, + sudachi_analyzer: { + tokenizer: 'standard', + filter: %w( + lowercase + asciifolding + cjk_width + elision + english_possessive_stemmer + english_stop + english_stemmer + ), + }, + hashtag: { tokenizer: 'keyword', filter: %w( @@ -129,7 +142,7 @@ class StatusesIndex < Chewy::Index }, }.freeze - settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: PRODUCTION_SETTINGS + settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: Rails.env.test? ? DEVELOPMENT_SETTINGS : PRODUCTION_SETTINGS index_scope ::Status.unscoped.kept.without_reblogs.includes( :media_attachments,