[object Object]

← back to Dw Photo Capture

CLIP /similar: DW-safe guard — only return storefront products w/ handle + DW-hosted image; drop wallquest.com hotlinks (broken imgs + private-label leak) + handleless entries; backfill to keep strip full

41d871a4ba7e2a7cefe62a64257a18e661bb1b86 · 2026-07-09 08:53:24 -0700 · steve@designerwallcoverings.com

Files touched

Diff

commit 41d871a4ba7e2a7cefe62a64257a18e661bb1b86
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date:   Thu Jul 9 08:53:24 2026 -0700

    CLIP /similar: DW-safe guard — only return storefront products w/ handle + DW-hosted image; drop wallquest.com hotlinks (broken imgs + private-label leak) + handleless entries; backfill to keep strip full
---
 visual-search/search_service.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/visual-search/search_service.py b/visual-search/search_service.py
index 127f1cc..1ee28d1 100644
--- a/visual-search/search_service.py
+++ b/visual-search/search_service.py
@@ -216,10 +216,18 @@ class H(BaseHTTPRequestHandler):
                 scored.append((base + boost, base, i))
             scored.sort(key=lambda t: t[0], reverse=True)
             res = []
-            for _rank, base, i in scored[:k]:
+            for _rank, base, i in scored:                 # iterate ALL (sorted desc), backfill to k good cards
+                if len(res) >= k: break
                 m = meta[i]
-                res.append({"dw_sku": m["dw_sku"], "image": m["image"], "pattern": m["pattern"],
-                            "vendor": m["vendor"], "handle": m.get("handle"), "score": round(base, 4)})
+                h = m.get("handle"); img = m.get("image") or ""
+                # DW-safe guard (customer-facing): only real storefront products with a DW-hosted image.
+                # Drops (1) handleless index entries (not real PDPs → broken /search-fallback cards) and
+                # (2) raw-vendor hotlinks like www.wallquest.com — those 404 (broken images) AND leak the
+                # private-label vendor to customers (WallQuest→Malibu). Backfill keeps the strip full.
+                if not h: continue
+                if "cdn.shopify.com" not in img and "designerwallcoverings.com" not in img: continue
+                res.append({"dw_sku": m["dw_sku"], "image": img, "pattern": m["pattern"],
+                            "vendor": m["vendor"], "handle": h, "score": round(base, 4)})
             self._send(200, {"ok": True, "n": STATE["n"], "query": {
                 "dw_sku": dw_sku, "family": qfam, "styles": sorted(qstyles)}, "results": res})
         except Exception as e:

← 0bd9187 iOS OOM-freeze root cause (found via mobile screenrecord 5x)  ·  back to Dw Photo Capture  ·  PDP color-dot color-index: /apps/color-index endpoint + gene 602bb7f →