From 3fb7904e34e247a544cbef11f34deddae80c5806 Mon Sep 17 00:00:00 2001 From: Anjana Vakil Date: Wed, 9 Oct 2024 17:26:46 -0700 Subject: [PATCH] Populate search field when resetting data --- convex/data.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/convex/data.ts b/convex/data.ts index 5f49fa7..1781c8c 100644 --- a/convex/data.ts +++ b/convex/data.ts @@ -275,8 +275,11 @@ export const reset = internalMutation({ await Promise.all(POSTS.map(async (p) => { const { authorIndex, ...post } = p; const authorId = userIds[authorIndex] + const { title, content, summary, slug, } = post; + const search = [title, content, summary, slug].join(' ') + const postId = await ctx.db.insert('posts', - { ...post, authorId, publishTime: Date.now() } + { ...post, authorId, publishTime: Date.now(), search } ); console.log(`Created document ${postId} in "posts" table`); const versionId = await ctx.db.insert('versions',