diff options
| author | Caipira <caipira@libnare.net> | 2023-07-08 21:31:38 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-08 21:31:38 +0900 |
| commit | 60366a45585654115d5178486cc747cf0ee9450a (patch) | |
| tree | 47cad89d513a3bae6459156125b1d6dd2a8c18eb /packages/backend/src/core/SearchService.ts | |
| parent | perf(backend): Reduce memory usage of MemoryKVCache (#11076) (diff) | |
| download | sharkey-60366a45585654115d5178486cc747cf0ee9450a.tar.gz sharkey-60366a45585654115d5178486cc747cf0ee9450a.tar.bz2 sharkey-60366a45585654115d5178486cc747cf0ee9450a.zip | |
fix(backend): Remove Meilisearch index when notes are deleted (#10988)
* fix(backend): Include feature to delete Meilisearch index notes
* Update variable name
`cascadingNotesFilter` -> `federatedLocalCascadingNotes`
* tweak
---------
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/backend/src/core/SearchService.ts')
| -rw-r--r-- | packages/backend/src/core/SearchService.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/backend/src/core/SearchService.ts b/packages/backend/src/core/SearchService.ts index 956c4cc09c..28b8ee8073 100644 --- a/packages/backend/src/core/SearchService.ts +++ b/packages/backend/src/core/SearchService.ts @@ -116,6 +116,15 @@ export class SearchService { } @bindThis + public async unindexNote(note: Note): Promise<void> { + if (!['home', 'public'].includes(note.visibility)) return; + + if (this.meilisearch) { + this.meilisearchNoteIndex!.deleteDocument(note.id); + } + } + + @bindThis public async searchNote(q: string, me: User | null, opts: { userId?: Note['userId'] | null; channelId?: Note['channelId'] | null; |