From 66d50474f5ea732e947ae2a4715f1be91ebb4be5 Mon Sep 17 00:00:00 2001 From: "Brennan Wilkes (Text Groove)" Date: Thu, 22 Jan 2026 13:43:04 -0800 Subject: [PATCH] feat: Better recs --- viz/app/linker_page.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/viz/app/linker_page.js b/viz/app/linker_page.js index c1b1f7b..d2447b8 100644 --- a/viz/app/linker_page.js +++ b/viz/app/linker_page.js @@ -283,7 +283,10 @@ function topSuggestions(allAgg, limit, otherPinnedSku, mappedSkus) { const stores = it.stores ? it.stores.size : 0; const hasPrice = it.cheapestPriceNum !== null ? 1 : 0; const hasName = it.name ? 1 : 0; - scored.push({ it, s: stores * 2 + hasPrice * 1.2 + hasName * 1.0 }); + + const unknown = String(it.sku || "").startsWith("u:") ? 1 : 0; + + scored.push({ it, s: stores * 2 + hasPrice * 1.2 + hasName * 1.0 + unknown * 0.6 }); } scored.sort((a, b) => b.s - a.s); return scored.slice(0, limit).map((x) => x.it); @@ -317,13 +320,20 @@ function recommendSimilar( ) continue; - const s = similarityScore(base, it.name || ""); + let s = similarityScore(base, it.name || ""); + + // Small boost if either side is an unknown sku (u:...) + const aUnknown = String(pinnedSku || "").startsWith("u:"); + const bUnknown = String(it.sku || "").startsWith("u:"); + if (aUnknown || bUnknown) s *= 1.12; + if (s > 0) scored.push({ it, s }); } scored.sort((a, b) => b.s - a.s); return scored.slice(0, limit).map((x) => x.it); } + function computeInitialPairsFast(allAgg, mappedSkus, limitPairs, isIgnoredPairFn) { const items = allAgg.filter((it) => { if (!it) return false;