Skip to content

Commit

Permalink
fix: get job graph embeddings by date before fetching from db
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdavis committed Feb 6, 2025
1 parent ddc0cd2 commit 7031331
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/registry/pages/api/jobs-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ export default async function handler(req, res) {
const { data: documents } = await supabase.rpc('match_jobs_v5', {
query_embedding: embedding,
match_threshold: -1,
match_count: 150,
match_count: 100,
created_after: new Date(
Date.now() - 65 * 24 * 60 * 60 * 1000
).toISOString(),
});

const sortedDocuments = documents.sort((a, b) => b.similarity - a.similarity);
Expand All @@ -91,6 +94,10 @@ export default async function handler(req, res) {
.from('jobs')
.select('*')
.in('id', jobIds)
.gte(
'created_at',
new Date(Date.now() - 65 * 24 * 60 * 60 * 1000).toISOString()
)
.order('created_at', { ascending: false });

// Add similarity scores to jobs
Expand Down

0 comments on commit 7031331

Please sign in to comment.