Skip to content

Commit

Permalink
release: v2024.3.1-kakurega.1.32.0 (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
hideki0403 authored Mar 2, 2024
2 parents 815df4b + a8b2b7a commit 63f353a
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 8 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG_KAKUREGA.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
## 1.32.0
Release: 2024/03/03
Base: 2024.3.1

### 新機能
- pgroongaのサポートを追加
- ノート検索が高速になります

> [!IMPORTANT]
> **1.32.0以降はpgroongaのインストールが必須になります**
> インストール方法は[こちら](https://pgroonga.github.io/ja/install/)を参照してください。
>
> #### マイグレーション時の注意点
> マイグレーションを行うユーザー (.config/default.yml のdbに記載されているユーザー) がスーパーユーザー権限を持っていないとコケる可能性があります。
> マイグレーション時に `QueryFailedError: permission denied to create extension "pgroonga"` が表示された場合は、一時的にスーパーユーザー権限を付与してマイグレーションを行ってください。
>
> #### pgroongaを使用しない場合
> 以下のコマンドを実行し、関連するコミットおよびコードを取り除いてください
> ```bash
> git revert 923c9de5c5cb1ba2e3e9c924f5227aaa61bd7f00
> git revert 4b63224f3a53a5e38f9a901e40c7a4fadbbd42a8
> ```
## 1.31.1
Release: 2024/03/02
Base: 2024.3.0
### 修正
- ピン留め or 履歴に表示されるカスタム絵文字がサーバから削除されるとリアクションが出来なくなる問題を修正 (cherry-picked from 6fdf30b4663a17bb7843246c703b2d20d4f1673a)
## 1.31.0
Release: 2024/03/01
Base: 2024.2.0
Expand Down
2 changes: 1 addition & 1 deletion docker-compose_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:

db:
restart: always
image: postgres:15-alpine
image: groonga/pgroonga:latest-alpine-15
networks:
- internal_network
env_file:
Expand Down
2 changes: 1 addition & 1 deletion locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5252,7 +5252,7 @@ export interface Locale extends ILocale {
* このサーバーからのフォロワーがいないリモートユーザーの、メンションを含むノートをブロックするようにします。
*/
"blockMentionsFromUnfamiliarRemoteUsersDescription": string;
/**
/**
* 読み込み中
*/
"loading": string;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "misskey",
"version": "2024.3.1-kakurega.1.31.1",
"version": "2024.3.1-kakurega.1.32.0",
"codename": "nasubi",
"repository": {
"type": "git",
Expand Down
23 changes: 23 additions & 0 deletions packages/backend/migration/1703417579791-pgroonga.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/

export class Pgroonga1703417579791 {
name = 'Pgroonga1703417579791'

async up(queryRunner) {
await queryRunner.query(`CREATE EXTENSION pgroonga`);
await queryRunner.query(`CREATE INDEX "IDX_f27f5d88941e57442be75ba9c8" ON "note" USING "pgroonga" ("text")`);
await queryRunner.query(`CREATE INDEX "IDX_065d4d8f3b5adb4a08841eae3c" ON "user" USING "pgroonga" ("name" pgroonga_varchar_full_text_search_ops_v2)`);
await queryRunner.query(`CREATE INDEX "IDX_fcb770976ff8240af5799e3ffc" ON "user_profile" USING "pgroonga" ("description" pgroonga_varchar_full_text_search_ops_v2) `);

}

async down(queryRunner) {
await queryRunner.query(`DROP INDEX "public"."IDX_f27f5d88941e57442be75ba9c8"`);
await queryRunner.query(`DROP INDEX "public"."IDX_065d4d8f3b5adb4a08841eae3c"`);
await queryRunner.query(`DROP INDEX "public"."IDX_fcb770976ff8240af5799e3ffc"`);
await queryRunner.query(`DROP EXTENSION pgroonga`);
}
}
2 changes: 1 addition & 1 deletion packages/backend/src/core/SearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class SearchService {
}

query
.andWhere('note.text ILIKE :q', { q: `%${ sqlLikeEscape(q) }%` })
.andWhere('note.text &@~ :q', { q: sqlLikeEscape(q) })
.innerJoinAndSelect('note.user', 'user', 'user.hideSearchResult = FALSE')
.leftJoinAndSelect('note.reply', 'reply')
.leftJoinAndSelect('note.renote', 'renote')
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/models/Note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class MiNote {
public threadId: string | null;

// TODO: varcharにしたい
@Index() // USING pgroonga
@Column('text', {
nullable: true,
})
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class MiUser {
})
public usernameLower: string;

@Index() // USING pgroonga pgroonga_varchar_full_text_search_ops_v2
@Column('varchar', {
length: 128, nullable: true,
comment: 'The name of the User.',
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/models/UserProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class MiUserProfile {
})
public birthday: string | null;

@Index() // USING pgroonga pgroonga_varchar_full_text_search_ops_v2
@Column('varchar', {
length: 2048, nullable: true,
comment: 'The description (bio) of the User.',
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/server/api/endpoints/notes/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export const meta = {
code: 'UNAVAILABLE',
id: '0b44998d-77aa-4427-80d0-d2c9b8523011',
},
noSuchNote: {
message: 'Query is empty.',
code: 'QUERY_IS_EMPTY',
id: 'd0410b51-f409-4667-8118-cfe999e453c3',
},
},
} as const;

Expand Down Expand Up @@ -62,6 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private roleService: RoleService,
) {
super(meta, paramDef, async (ps, me) => {
if (ps.query.trim().length === 0) throw new ApiError(meta.errors.noSuchNote);
const policies = await this.roleService.getUserPolicies(me ? me.id : null);
if (!policies.canSearchNotes) {
throw new ApiError(meta.errors.unavailable);
Expand Down
8 changes: 4 additions & 4 deletions packages/backend/src/server/api/endpoints/users/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} else {
const nameQuery = this.usersRepository.createQueryBuilder('user')
.where(new Brackets(qb => {
qb.where('user.name ILIKE :query', { query: '%' + sqlLikeEscape(ps.query) + '%' });
qb.where('user.name &@~ :query', { query: ps.query });

// Also search username if it qualifies as username
if (this.userEntityService.validateLocalUsername(ps.query)) {
qb.orWhere('user.usernameLower LIKE :username', { username: '%' + sqlLikeEscape(ps.query.toLowerCase()) + '%' });
if (userEntityService.validateLocalUsername(ps.query)) {
qb.orWhere('user.usernameLower LIKE :username', { username: ps.query.toLowerCase() + '%' });
}
}))
.andWhere(new Brackets(qb => {
Expand All @@ -114,7 +114,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (users.length < ps.limit) {
const profQuery = this.userProfilesRepository.createQueryBuilder('prof')
.select('prof.userId')
.where('prof.description ILIKE :query', { query: '%' + sqlLikeEscape(ps.query) + '%' });
.where('prof.description &@~ :query', { query: ps.query });

if (ps.origin === 'local') {
profQuery.andWhere('prof.userHost IS NULL');
Expand Down

0 comments on commit 63f353a

Please sign in to comment.