From 45fa13ae96c9de0d76635418c71f349910c85342 Mon Sep 17 00:00:00 2001 From: highemerly Date: Sun, 29 May 2022 21:12:27 +0900 Subject: [PATCH 01/22] =?UTF-8?q?[Change]=20=E6=97=A5=E6=9C=AC=E8=AA=9E?= =?UTF-8?q?=E6=A4=9C=E7=B4=A2=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B=E6=9C=80?= =?UTF-8?q?=E9=81=A9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 検索クエリを分かち書きを行わない言語に最適化 - 形態素解析を行うためにElasticsearch側にkuromojiを導入 - 検索結果をマッチ度順ではなく日付順に変更 Conflicts: app/chewy/statuses_index.rb --- app/chewy/statuses_index.rb | 27 +++++++++------------------ app/services/search_service.rb | 4 +++- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb index 6dd4fb18b024dc..6f5d0bcca79f06 100644 --- a/app/chewy/statuses_index.rb +++ b/app/chewy/statuses_index.rb @@ -4,30 +4,21 @@ class StatusesIndex < Chewy::Index include FormattingHelper settings index: { refresh_interval: '30s' }, analysis: { - filter: { - english_stop: { - type: 'stop', - stopwords: '_english_', - }, - english_stemmer: { - type: 'stemmer', - language: 'english', - }, - english_possessive_stemmer: { - type: 'stemmer', - language: 'possessive_english', + tokenizer: { + kuromoji_user_dict: { + type: 'kuromoji_tokenizer', + user_dictionary: 'userdic.txt', }, }, analyzer: { content: { - tokenizer: 'uax_url_email', + type: 'custom', + tokenizer: 'kuromoji_user_dict', filter: %w( - english_possessive_stemmer - lowercase - asciifolding + kuromoji_baseform + kuromoji_stemmer cjk_width - english_stop - english_stemmer + lowercase ), }, }, diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 1a76cbb388316c..d340789602ada0 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -35,7 +35,9 @@ def perform_accounts_search! end def perform_statuses_search! - definition = parsed_query.apply(StatusesIndex.filter(term: { searchable_by: @account.id })) + definition = StatusesIndex.filter(term: { searchable_by: @account.id }) + .query(match: { 'text.stemmed': { query: @query, operator: 'and'}}) + .order(id: { order: 'desc' }) if @options[:account_id].present? definition = definition.filter(term: { account_id: @options[:account_id] }) From cf9a0de893f7564b3b0fabd7066a0bbab220695f Mon Sep 17 00:00:00 2001 From: highemerly Date: Fri, 13 Sep 2019 18:21:10 +0900 Subject: [PATCH 02/22] =?UTF-8?q?[Change]=20=E6=8A=95=E7=A5=A8=E6=8A=95?= =?UTF-8?q?=E7=A8=BF=E6=99=82=E3=81=AEWeb/API=E4=B8=8A=E3=81=AE=E3=83=91?= =?UTF-8?q?=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 投票作成時,その選択肢の数の上限を4から16に変更 - 投票作成時,その有効期限をより細かく設定出来るように変更 --- .../mastodon/features/compose/components/poll_form.js | 5 ++++- app/validators/poll_validator.rb | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js index ede29b8a08a97e..763343d7d65b16 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.js +++ b/app/javascript/mastodon/features/compose/components/poll_form.js @@ -157,13 +157,16 @@ class PollForm extends ImmutablePureComponent {
- + {/* eslint-disable-next-line jsx-a11y/no-onchange */}