File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ export async function GET(request: NextRequest) {
9191 combinedScore :
9292 "combinedScore" in topic
9393 ? topic . combinedScore
94- : topic . occurrence_count * topic . avg_tfidf_score ,
94+ : Math . log ( topic . occurrence_count + 1 ) * topic . avg_tfidf_score ,
9595 } ) ) ,
9696 metadata : {
9797 timeWindow,
Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ export async function getTrendingTopics(options?: {
319319 }
320320
321321 query += `
322- ORDER BY (occurrence_count * avg_tfidf_score) DESC
322+ ORDER BY (LOG( occurrence_count + 1) * avg_tfidf_score) DESC
323323 LIMIT ?
324324 `
325325 params . push ( limit )
Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ export async function getDiverseTopics(options?: {
270270 params . push ( limit * 3 ) // Get more for randomization
271271 } else {
272272 query += `
273- ORDER BY (occurrence_count * avg_tfidf_score) DESC
273+ ORDER BY (LOG( occurrence_count + 1) * avg_tfidf_score) DESC
274274 LIMIT ?
275275 `
276276 params . push ( limit * 2 ) // Get more to filter for diversity
@@ -287,7 +287,7 @@ export async function getDiverseTopics(options?: {
287287 occurrenceCount,
288288 avgTfidfScore,
289289 lastSeenAt : row . last_seen_at as string ,
290- combinedScore : occurrenceCount * avgTfidfScore ,
290+ combinedScore : Math . log ( occurrenceCount + 1 ) * avgTfidfScore ,
291291 }
292292 } )
293293
You can’t perform that action at this time.
0 commit comments