Update Chinese search optimization for 4.2.0

See mastodon/mastodon#27024
This commit is contained in:
Tyketc 2023-09-23 09:01:53 +00:00 committed by GitHub
parent e4e88f0fb7
commit 5cfa43953f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 0 deletions

View File

@ -170,6 +170,43 @@ diff --git a/app/chewy/accounts_index.rb b/app/chewy/accounts_index.rb
filter: %w(lowercase asciifolding cjk_width),
},
diff --git a/app/chewy/public_statuses_index.rb b/app/chewy/public_statuses_index.rb
--- a/app/chewy/public_statuses_index.rb
+++ b/app/chewy/public_statuses_index.rb
@@ -19,6 +19,15 @@ class PublicStatusesIndex < Chewy::Index
},
},
+ char_filter: {
+ tsconvert: {
+ type: 'stconvert',
+ keep_both: false,
+ delimiter: '#',
+ convert_type: 't2s',
+ },
+ },
+
analyzer: {
verbatim: {
tokenizer: 'uax_url_email',
@@ -26,7 +35,7 @@ class PublicStatusesIndex < Chewy::Index
},
content: {
- tokenizer: 'standard',
+ tokenizer: 'ik_max_word',
filter: %w(
lowercase
asciifolding
@@ -36,6 +45,7 @@ class PublicStatusesIndex < Chewy::Index
english_stop
english_stemmer
),
+ char_filter: %w(tsconvert),
},
hashtag: {
diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb
--- a/app/chewy/statuses_index.rb
+++ b/app/chewy/statuses_index.rb