[wip] feat: Meilisearchの再インデックスをコントロールパネルから出来るようにする#16133
[wip] feat: Meilisearchの再インデックスをコントロールパネルから出来るようにする#16133samunohito wants to merge 5 commits intomisskey-dev:developfrom
Conversation
|
このPRによるapi.jsonの差分 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #16133 +/- ##
===========================================
- Coverage 45.86% 45.79% -0.08%
===========================================
Files 1781 1781
Lines 184646 184766 +120
Branches 5514 5511 -3
===========================================
- Hits 84695 84607 -88
- Misses 99922 100119 +197
- Partials 29 40 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| @Injectable() | ||
| export class SearchService { | ||
| public static MeilisearchNotActiveError = class extends Error { |
There was a problem hiding this comment.
IdentifiableError にするかこういうふうにするかをそろそろ定めたほうが良さそう...
(IdentifiableErrorのuuidを static 変数にすればいいかなと思ってる)
There was a problem hiding this comment.
エラーを定義する方針を決めるIssue、立てますか。
There was a problem hiding this comment.
Pull Request Overview
This PR adds re-indexing functionality for Meilisearch notes in the SearchService. The changes enable batch re-indexing of notes within a specific date range and improve code organization by extracting common document addition logic.
- Adds a new
reIndexNotesmethod to re-index notes in Meilisearch for a specified date range - Extracts document addition logic into a reusable
addDocumentmethod - Adds
unindexNoteAllmethod to clear all indexed documents - Includes minor code formatting improvements
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
| while (true) { | ||
| const notes = await fetchNote(sinceId, untilId, fetchedCount, 100); |
There was a problem hiding this comment.
The pagination logic is incorrect. fetchedCount is passed as the take parameter but it's meant to track the total count of processed notes, not to paginate through results. The loop will always fetch the same notes because there's no cursor-based pagination (no lastNoteId is used in the next iteration). Change the logic to use lastNoteId as the untilId parameter for subsequent iterations: await fetchNote(sinceId, lastNoteId ?? untilId, undefined, 100).
| const notes = await fetchNote(sinceId, untilId, fetchedCount, 100); | |
| const notes = await fetchNote(sinceId, lastNoteId ?? untilId, 100, 100); |
|
どこに起動用のボタンを置くか悩み中(最悪cliでもいい?) |
|
最悪cliでもよさそう |
|
とりあえずcliで(リクエストあったら何処かに生やす方針) |
|
API自体は生えてる感じかしら |
|
Meilisearchの再インデックス機能そのものが存在してなくて、このprで実装してる感じです(Serviceだけ実装して止まってる) |
|
APIはあっても良さそう |
What
あとからMeilisearchに切り替えた後でも、切り替える以前のノートをコントロールパネルからマイグレーション出来るようになります。
Why
fix #10789
Additional info (optional)
Checklist