Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/web/src/routes/api/v1/apps/suggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const Route = createFileRoute('/api/v1/apps/suggest')({
return appJsonResponse({ posts: resultPosts })
}

// Vector similarity search across all boards
// Vector similarity search over public, active boards only
const vectorStr = `[${embedding.join(',')}]`
const minSimilarity = 0.5

Expand All @@ -66,6 +66,8 @@ export const Route = createFileRoute('/api/v1/apps/suggest')({
.where(
and(
isNull(posts.deletedAt),
eq(boards.isPublic, true),
isNull(boards.deletedAt),
sql`${posts.embedding} IS NOT NULL`,
sql`1 - (${posts.embedding} <=> ${vectorStr}::vector) >= ${minSimilarity}`
)
Expand Down