From 2162f87cfbddba0147b4a8f0cca4250dbe606920 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Fri, 15 Sep 2023 22:17:03 -0500 Subject: [PATCH] fix: filter search content by posts that are not children --- convex/posts.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/convex/posts.ts b/convex/posts.ts index 278c537..581dfe6 100644 --- a/convex/posts.ts +++ b/convex/posts.ts @@ -278,7 +278,9 @@ export const getPostsBySearchTerm = query({ handler: async (ctx, args) => { return await ctx.db .query('posts') - .withSearchIndex('search_by_content', q => q.search('content', args.term)) + .withSearchIndex('search_by_content', q => + q.search('content', args.term).eq('parentPostId', undefined) + ) .paginate(args.paginationOpts); }, });