From f809d925e3a0410ccb1fe56adfdc76c2e5fb09ab Mon Sep 17 00:00:00 2001 From: highemerly Date: Fri, 13 Sep 2019 18:19:59 +0900 Subject: [PATCH 01/19] =?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を導入 - 検索結果をマッチ度順ではなく日付順に変更 --- 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 47cb856ea944a4..89d6607c62c3f4 100644 --- a/app/chewy/statuses_index.rb +++ b/app/chewy/statuses_index.rb @@ -2,30 +2,21 @@ 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: { + 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 f17bf7e1542adb392a44ffa97005ed9235ea77cd Mon Sep 17 00:00:00 2001 From: highemerly Date: Fri, 13 Sep 2019 18:21:10 +0900 Subject: [PATCH 02/19] =?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 db49f90eb4cb95..f322298a827acd 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 */}