From e7e39bed1f37324b45d39333c89496958976e582 Mon Sep 17 00:00:00 2001 From: Malin Date: Thu, 7 May 2026 11:14:17 +0200 Subject: [PATCH] fix: Not checked always routes to DuckDB regardless of assessed filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit assessed='no' (Not assessed) was truthy, forcing hasEnrichFilter=true and routing to SQLite even when prescreen_status='none'. But domains that have never been prescreened don't exist in SQLite at all → 0 results every time. Rule: if prescreen_status='none', always use DuckDB. Enrichment-only filters (niche, site_type, country, assessed) are irrelevant for domains that haven't entered the pipeline and must not override the DuckDB path. Co-Authored-By: Claude Sonnet 4.6 --- app/static/beauty/index.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/static/beauty/index.html b/app/static/beauty/index.html index 57fb0d5..b32771f 100644 --- a/app/static/beauty/index.html +++ b/app/static/beauty/index.html @@ -520,11 +520,14 @@ function app() { if (snap.alpha_only) p.set('alpha_only', 'true'); if (snap.no_sld) p.set('no_sld', 'true'); - // 'none' (Not checked) = domains never in the pipeline → DuckDB search. - // Any real status (live/dead/…), niche, site_type, country, or assessed - // requires the SQLite enriched_domains table (all server-side). - const hasEnrichFilter = (snap.prescreen_status && snap.prescreen_status !== 'none') - || snap.niche || snap.site_type || snap.country || snap.assessed; + // 'none' (Not checked) = domains never in the pipeline → always DuckDB. + // Enrichment filters (niche, site_type, country, assessed) only apply to + // domains that are already in SQLite, so they are irrelevant — and must not + // force the SQLite path — when prescreen_status is 'none'. + const isNotChecked = snap.prescreen_status === 'none'; + const hasEnrichFilter = !isNotChecked && ( + snap.prescreen_status || snap.niche || snap.site_type || snap.country || snap.assessed + ); let endpoint; if (hasEnrichFilter) { if (snap.prescreen_status) p.set('prescreen_status', snap.prescreen_status); @@ -550,11 +553,11 @@ function app() { // 'Not checked': DuckDB returns all domains joined with enriched data; // keep only those with no prescreen_status yet (truly unprocessed). - if (snap.prescreen_status === 'none') rows = rows.filter(r => !r.prescreen_status); + if (isNotChecked) rows = rows.filter(r => !r.prescreen_status); // Auto-advance: current DuckDB page was fully processed → try next page // (prevents "0 results" after bulk-validating a page of Not checked domains) - if (rows.length === 0 && snap.prescreen_status === 'none' + if (rows.length === 0 && isNotChecked && (d.results||[]).length > 0 && snap.page < 500) { this.f.page = snap.page + 1; // Do NOT await — start the next page search as a fresh call so the