From 546139e82f151b35d6492b7cbf2ac89dbfd5d0b5 Mon Sep 17 00:00:00 2001 From: kamtschatka Date: Sun, 9 Jun 2024 20:11:23 +0200 Subject: fix: Trigger search re-index on bookmark tag manual updates. Fixes #208 (#210) * re-index of database is not scanning all places when bookmark tags are changed. Manual indexing is working as workaround #208 introduced a new function to trigger a reindex to reduce copy/paste added missing reindexes when tags are deleted/bookmarks are updated * give functions a bit more descriptive name --------- Co-authored-by: kamtschatka Co-authored-by: MohamedBassem --- packages/shared/queues.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'packages/shared') diff --git a/packages/shared/queues.ts b/packages/shared/queues.ts index 86ca32c5..2b890755 100644 --- a/packages/shared/queues.ts +++ b/packages/shared/queues.ts @@ -69,3 +69,17 @@ export const SearchIndexingQueue = new Queue( }, }, ); + +export function triggerSearchReindex(bookmarkId: string) { + SearchIndexingQueue.add("search_indexing", { + bookmarkId, + type: "index", + }); +} + +export function triggerSearchDeletion(bookmarkId: string) { + SearchIndexingQueue.add("search_indexing", { + bookmarkId: bookmarkId, + type: "delete", + }); +} -- cgit v1.2.3-70-g09d2