From 81f0c73bb624e8427178e6f78c4734f55510ac21 Mon Sep 17 00:00:00 2001 From: Mikey Date: Sat, 19 Sep 2026 20:10:30 +0530 Subject: [PATCH] fix search ranking by track title --- apps/web/components/ContentSearch.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/web/components/ContentSearch.tsx b/apps/web/components/ContentSearch.tsx index bb5e4c0e..efb804fb 100644 --- a/apps/web/components/ContentSearch.tsx +++ b/apps/web/components/ContentSearch.tsx @@ -44,10 +44,13 @@ export function ContentSearch({ tracks }: { tracks: TrackPros[] }) { }); }); setAllTracks(updatedTracks); - }, []); + }, [tracks]); useEffect(() => { const fuse = new Fuse(allTracks, { - keys: ["payload.problemTitle"], + keys: [ + { name: "payload.trackTitle", weight: 0.7 }, + { name: "payload.problemTitle", weight: 0.3 }, + ], }); async function fetchSearchResults() { @@ -61,7 +64,7 @@ export function ContentSearch({ tracks }: { tracks: TrackPros[] }) { } } fetchSearchResults(); - }, [deferredInput]); + }, [allTracks, deferredInput]); useEffect(() => { const handleKeyPress = (event: KeyboardEvent) => {