fix: add column to posts table that is a string of content to use search index on

This commit is contained in:
Stevan Freeborn
2023-09-16 10:53:28 -05:00
parent 18cb4fe0d9
commit e2161e62c3
6 changed files with 53 additions and 21 deletions
+2 -1
View File
@@ -44,11 +44,12 @@ export default defineSchema(
parentPostId: v.optional(v.id('posts')),
userId: v.id('users'),
content: v.array(v.string()),
contentText: v.string(),
})
.index('by_user_id', ['userId'])
.index('by_parent_id', ['parentPostId'])
.searchIndex('search_by_content', {
searchField: 'content',
searchField: 'contentText',
filterFields: ['parentPostId'],
}),
likes: defineTable({