diff --git a/CHANGELOG_YOJO.md b/CHANGELOG_YOJO.md index 2d0a85d47a..b389c2cb95 100644 --- a/CHANGELOG_YOJO.md +++ b/CHANGELOG_YOJO.md @@ -58,6 +58,7 @@ Cherrypick 4.11.1 ### Server - Change: `api/admin/recreate-index`では再インデックスをしないように +- Fix: 高度な検索でノート本文に含まれないタグが検索対象外なのを修正 - Enhance: リモートユーザーの`/api/clips/show`と`/api/users/clips`の応答にemojisを追加 [#466](https://github.com/yojo-art/cherrypick/pull/466) - Fix: Opensearch利用時ファイルのセンシティブ状態が変更されたとき変更されるように - Change: `notes/advanced-search`で`query`が必須ではなくなりました diff --git a/packages/backend/migration/1729457336777-AddSearchable.js b/packages/backend/migration/1729457336777-AddSearchable.js index b8485e57ef..08cd89369d 100644 --- a/packages/backend/migration/1729457336777-AddSearchable.js +++ b/packages/backend/migration/1729457336777-AddSearchable.js @@ -6,15 +6,16 @@ export class AddSearchable1729457336777 { name = 'AddSearchable1729457336777'; async up(queryRunner) { - await queryRunner.query('ALTER TABLE "user" ADD "searchableBy" "public"."user_searchableby_enum"'); + await queryRunner.query('CREATE TYPE "public"."user_searchableby_enum" AS ENUM(\'public\', \'followersAndReacted\', \'reactedOnly\', \'private\')'); await queryRunner.query('CREATE TYPE "public"."note_searchableby_enum" AS ENUM(\'public\', \'followersAndReacted\', \'reactedOnly\', \'private\')'); + await queryRunner.query('ALTER TABLE "user" ADD "searchableBy" "public"."user_searchableby_enum"'); await queryRunner.query('ALTER TABLE "note" ADD "searchableBy" "public"."note_searchableby_enum"'); - await queryRunner.query('CREATE INDEX "IDX_3932b42da4cf440203d2013649" ON "user" ("searchableBy") '); - } + } async down(queryRunner) { await queryRunner.query('ALTER TABLE "note" DROP COLUMN "searchableBy"'); - await queryRunner.query('DROP TYPE "public"."note_searchableby_enum"'); await queryRunner.query('ALTER TABLE "user" DROP COLUMN "searchableBy"'); + await queryRunner.query('DROP TYPE "public"."note_searchableby_enum"'); + await queryRunner.query('DROP TYPE "public"."user_searchableby_enum"'); } }; diff --git a/packages/backend/src/core/AdvancedSearchService.ts b/packages/backend/src/core/AdvancedSearchService.ts index 76e86f2cff..739c33633f 100644 --- a/packages/backend/src/core/AdvancedSearchService.ts +++ b/packages/backend/src/core/AdvancedSearchService.ts @@ -951,7 +951,7 @@ export class AdvancedSearchService { } if (q && q !== '') { - const fields = [opts.useStrictSearch ? 'text.keyword' : 'text']; + const fields = ['tags', opts.useStrictSearch ? 'text.keyword' : 'text']; if (!opts.excludeCW) { fields.push(opts.useStrictSearch ? 'cw.keyword' : 'cw' );} osFilter.bool.must.push({ simple_query_string: { fields: fields, 'query': q, default_operator: 'and' } }); }