fix: Not checked always routes to DuckDB regardless of assessed filter
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user