Skip to content

Commit

Permalink
fix: Index the summary in search
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Oct 27, 2024
1 parent e06a5ea commit 801ba36
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/workers/searchWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ async function runIndex(
: undefined),
...(bookmark.text ? { content: bookmark.text.text } : undefined),
note: bookmark.note,
summary: bookmark.summary,
title: bookmark.title,
createdAt: bookmark.createdAt.toISOString(),
tags: bookmark.tagsOnBookmarks.map((t) => t.tag.name),
Expand Down
1 change: 1 addition & 0 deletions packages/shared/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const zBookmarkIdxSchema = z.object({
fileName: z.string().nullish(),
createdAt: z.string().nullish(),
note: z.string().nullish(),
summary: z.string().nullish(),
tags: z.array(z.string()).default([]),
});

Expand Down
3 changes: 2 additions & 1 deletion packages/trpc/routers/bookmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ export const bookmarksAppRouter = router({
});
}
const bookmark = await ctx.db.query.bookmarkLinks.findFirst({
where: and(eq(bookmarks.id, input.bookmarkId)),
where: eq(bookmarkLinks.id, input.bookmarkId),
});

if (!bookmark) {
Expand Down Expand Up @@ -1032,6 +1032,7 @@ Content: ${bookmark.content ?? ""}
summary: summary.response,
})
.where(eq(bookmarks.id, input.bookmarkId));
await triggerSearchReindex(input.bookmarkId);

return {
bookmarkId: input.bookmarkId,
Expand Down

0 comments on commit 801ba36

Please sign in to comment.