diff --git a/packages/scraper/src/scrapers/community-issues.ts b/packages/scraper/src/scrapers/community-issues.ts index 7869a1e..c129ba3 100644 --- a/packages/scraper/src/scrapers/community-issues.ts +++ b/packages/scraper/src/scrapers/community-issues.ts @@ -403,14 +403,29 @@ export async function findAndSeedDatasheetLinks(limit = 50): Promise { // Scrape transceiver-specific issues per switch (switch + transceiver combos) // ───────────────────────────────────────────────────────────────────────────── export async function scrapeTransceiverCompatIssues(switchLimit = 20): Promise { - // Get switches that have compatibility entries — search for their transceiver issues + // Prefer switches with known compatibility entries; fall back to switches with port_config const result = await pool.query<{ switch_model: string; form_factors: string[] }>( `SELECT sw.model AS switch_model, - ARRAY_AGG(DISTINCT t.form_factor) AS form_factors + COALESCE( + ARRAY_AGG(DISTINCT t.form_factor) FILTER (WHERE t.form_factor IS NOT NULL), + -- Fall back: extract form factors from ports_config keys + ARRAY(SELECT DISTINCT + CASE + WHEN k LIKE '%QSFP-DD%' THEN 'QSFP-DD' + WHEN k LIKE '%QSFP28%' THEN 'QSFP28' + WHEN k LIKE '%QSFP%' THEN 'QSFP+' + WHEN k LIKE '%SFP28%' THEN 'SFP28' + WHEN k LIKE '%SFP%' THEN 'SFP+' + WHEN k LIKE '%OSFP%' THEN 'OSFP' + END + FROM jsonb_object_keys(sw.ports_config) AS k + WHERE sw.ports_config IS NOT NULL + ) + ) AS form_factors FROM switches sw - JOIN compatibility c ON c.switch_id = sw.id - JOIN transceivers t ON c.transceiver_id = t.id - GROUP BY sw.model + LEFT JOIN compatibility c ON c.switch_id = sw.id + LEFT JOIN transceivers t ON c.transceiver_id = t.id + GROUP BY sw.model, sw.ports_config ORDER BY COUNT(c.id) DESC LIMIT $1`, [switchLimit],