← back to Dw Pairs Well
similar: flag archived/non-live source with 'archived' + reason instead of a silent empty strip
5c2a34e21c57c0d34c38629d3cf100e57d5ec82c · 2026-07-13 12:17:42 -0700 · Steve Abrams
An empty similar strip only occurs for ARCHIVED/unpublished source SKUs (no live
product page). Surfacing source.status !== ACTIVE as archived:true + a reason makes
that self-explaining and prevents future 'is the site broken?' scares. Purely
additive — active-product responses gain only archived:false, no behavior change.
Files touched
Diff
commit 5c2a34e21c57c0d34c38629d3cf100e57d5ec82c
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jul 13 12:17:42 2026 -0700
similar: flag archived/non-live source with 'archived' + reason instead of a silent empty strip
An empty similar strip only occurs for ARCHIVED/unpublished source SKUs (no live
product page). Surfacing source.status !== ACTIVE as archived:true + a reason makes
that self-explaining and prevents future 'is the site broken?' scares. Purely
additive — active-product responses gain only archived:false, no behavior change.
---
server.js | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/server.js b/server.js
index 87193a7..34820af 100644
--- a/server.js
+++ b/server.js
@@ -105,7 +105,7 @@ function parsePaletteParam(raw) {
}
const SOURCE_COLS = `
- sp.dw_sku, sp.handle, sp.title, sp.vendor, sp.image_url, sp.tags, sp.pattern_name,
+ sp.dw_sku, sp.handle, sp.title, sp.vendor, sp.image_url, sp.tags, sp.pattern_name, sp.status,
sce.dominant_hex, sce.background_hex, sce.hex_codes, sce.color_family
`;
@@ -1085,9 +1085,11 @@ app.get('/api/similar', async (req, res) => {
if (!source.tags || parseTags(source.tags).length === 0) {
return res.json({
ok: true, engine: 'tag',
- source: { dw_sku: source.dw_sku, handle: source.handle, title: source.title, image_url: source.image_url, vendor: source.vendor },
+ source: { dw_sku: source.dw_sku, handle: source.handle, title: source.title, image_url: source.image_url, vendor: source.vendor, archived: source.status !== 'ACTIVE' },
similar: [],
- reason: 'no tags on source — cannot compute similar designs'
+ reason: source.status !== 'ACTIVE'
+ ? `source is ${source.status} (not a live product) — no similar designs`
+ : 'no tags on source — cannot compute similar designs'
});
}
const candidates = await loadSimilarCandidates(source, 1200);
@@ -1107,8 +1109,12 @@ app.get('/api/similar', async (req, res) => {
engine: usedEngine,
source: {
dw_sku: source.dw_sku, handle: source.handle, title: source.title,
- vendor: source.vendor, image_url: source.image_url, palette: paletteWithPaints(sourcePalette, paintMap)
+ vendor: source.vendor, image_url: source.image_url, archived: source.status !== 'ACTIVE',
+ palette: paletteWithPaints(sourcePalette, paintMap)
},
+ // an empty strip on an archived/unpublished source is expected, not a fault
+ ...(top.length === 0 && source.status !== 'ACTIVE'
+ ? { reason: `source is ${source.status} (not a live product) — no similar designs` } : {}),
similar: top.map(p => ({
dw_sku: p.dw_sku, handle: p.handle, title: safeTitle(p), vendor: p.vendor,
image_url: p.image_url, url: `/products/${p.handle}`,
← f89ae0b add reload-visual-search.sh: resolve :9914 owner by listenin
·
back to Dw Pairs Well
·
pipe-title-backfill: apply 2 genuine-name draft rows (Dig-54 73d4393 →