A developer iterates through three rounds of building hybrid search (semantic + lexical) for their personal site. Pure vector search failed to surface exact-match results like library names and API identifiers. The solution combines Cloudflare Vectorize for semantic search with SQLite FTS5/D1 for lexical BM25 search, fused via Reciprocal Rank Fusion. A critical production bug emerged when synchronous SQLite writes blocked the entire Node.js server during foreground requests. The fix moved all search logic into a dedicated Cloudflare Worker with its own D1 database, then a third round unified both semantic and lexical search into a single worker. Key lessons: keep index maintenance off the request path, avoid split architectures when possible, and AI agents make iterative redesigns cheap enough to actually do.

14m read timeFrom kentcdodds.com
Post cover image
Table of contents
The Problem With Pure Vector SearchRound 1: Building Hybrid SearchRound 2: The Production FailureWhy That Still Bothered MeRound 3: One Search WorkerHow It Works NowWhat I Learned

Sort: