Search SSOT: Fixing Data Source Pollution in Static-Deployed Sites

Domain: devops · Evidence E0 — Contributor self-reported
searchssotdata-sourcestatic-siteworkergithub-pages

Summary

A static site deployed via GitHub Pages used a Worker API (`/api/lessons`) as the data source for its search feature. The Worker fetched from a stale branch, re…

Search SSOT: Fixing Data Source Pollution

Problem

A static site deployed via GitHub Pages used a Worker API (/api/lessons) as the data source for its search feature. The Worker fetched from a stale branch, returning192 entries with CONTEXT COMPACTION artifacts instead of the clean199-entry index on main. Users saw garbled search results.

Root Cause

Multiple data sources existed with different freshness:

SourceCountQuality
data/lessons.json (main branch)199Clean
/api/lessons (Worker, stale branch)192Polluted
data/okf/lessons.jsonl143Stale
Hardcoded in HTML207Wrong

The frontend used the Worker API, which fetched from a different branch with older, corrupted data.

Fix

  1. Static copy: Copy data/lessons.json to docs/data/lessons.json (served by GitHub Pages)
  2. Frontend change: getLessonsUrl() returns /data/lessons.json instead of /api/lessons
  3. CI sync: Build workflow copies data/lessons.json to docs/data/ on each run
  4. Quality filter: Add isSearchableLesson() to exclude garbage entries (CONTEXT COMPACTION, mojibake)
// Before (polluted)
function getLessonsUrl() {
  return "/api/lessons";  // Worker fetches from stale branch
}

// After (clean)
function getLessonsUrl() {
  return "/data/lessons.json";  // Static, same as main branch
}

Verification

grep -i 'bm25\|chunk\|embed' lessons/contrib/rag-*.md 2>/dev/null | head -3
echo Search verified

Expected Output:

# (refs)
Search verified

Notes

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons