TL;DR

A developer used PartyKit together with Cloudflare’s Vectorize and Workers AI embedding model to add semantic search to a static site listing BBC Radio 4’s In Our Time episodes. The project converts episode text into embeddings, stores them in a vector database, and serves nearest-neighbour results via a small PartyKit server and a simple query API.

What happened

The author built a semantic search for Braggoscope, a static directory of more than 1,000 episodes of BBC Radio 4’s In Our Time, by converting episode text into embedding vectors and storing them in Cloudflare’s Vectorize. They scaffolded a PartyKit project (using a Remix starter template), enabled PartyKit’s AI and Vectorize integrations, and created a minimal PartyKit server that calls a Workers AI embedding model (@cf/baai/bge-base-en-v1.5). During indexing, episode descriptions are batched into embeddings, combined with metadata (title, date, permalink) and upserted into the vector index. A web admin UI triggers indexing (protected by a simple secret key in the URL) and shows progress. Queries work by embedding the user’s search string, requesting nearest neighbours from the index (topK 15) and returning stored metadata to the client. The code and demo are available in a public repo and a deployed PartyKit site.

Why it matters

  • Semantic search can surface relevant results from natural-language queries, not just keyword matches.
  • Embedding models plus vector databases simplify building semantic search without complex custom algorithms.
  • PartyKit’s integrations let developers combine web UI, AI model calls, and a managed vector index in one workflow.
  • Cloudflare’s Vectorize and Workers AI provide hosted tools for embeddings and vector storage, reducing infrastructure overhead.

Key facts

  • Braggoscope is a static GitHub Pages site listing 1,000+ episodes of In Our Time.
  • The project generates a JSON file (episodes.json) containing episode id, title, published date, permalink and description for indexing.
  • The embedding model used is @cf/baai/bge-base-en-v1.5 via Workers AI.
  • A Vectorize index named braggoscope-index was created with: npx partykit vectorize create braggoscope-index –preset @cf/baai/bge-base-en-v1.5.
  • Indexing batches episode descriptions into embeddings, packages them with id and metadata, and upserts them into the vector index.
  • Queries: the search API embeds the query, asks the index for nearest vectors (topK: 15) and returns metadata and a score for each match.
  • A minimal PartyKit server (search.ts) hosts the indexing and query endpoints; CORS handling allows cross-origin POST requests from the static site.
  • An admin UI triggers indexing; the example uses an environment variable BRAGGOSCOPE_SEARCH_ADMIN_KEY and a secret key in the admin URL.
  • Repository and demo: https://github.com/genmon/braggoscope-search and a deployed demo at braggoscope-search.genmon.partykit.dev.

What to watch next

  • Admin UI security: the demo uses a secret key in the URL as minimal protection—further hardening is not discussed in the source.
  • Vectorize configuration and model presets: PartyKit relays Cloudflare presets; additional index tuning is possible but not detailed in the source.
  • Performance and cost at broader scale: not confirmed in the source.

Quick glossary

  • Embedding: A numeric vector that represents the semantic content of a piece of text, enabling comparison by distance in high-dimensional space.
  • Vector database: A storage system optimized for indexing and querying high-dimensional vectors, typically used to find nearest neighbours efficiently.
  • Semantic search: Search that returns results based on meaning and context rather than exact keyword matches.
  • Upsert: An operation that inserts new records into a database or updates existing ones if they already exist.
  • Nearest-neighbour search: A query that finds vectors in a dataset closest to a given query vector, measured by a distance or similarity metric.

Reader FAQ

What components were used to build the search?
PartyKit for the server and UI, Cloudflare Workers AI for embeddings, and Cloudflare Vectorize for the vector database.

How do you run the app locally?
The source shows running npm run dev and visiting http://127.0.0.1:1999/admin?key=dummy-key for the admin UI.

Which embedding model is used?
@cf/baai/bge-base-en-v1.5 is used to convert text into vectors.

Is PartyKit required to reproduce this?
Not confirmed in the source.

How long does indexing take?
Indexing is said to take a few minutes in the example.

The tl;dr is that search got really good suddenly and really easy to build because of AI. For instance, this is the search experience I recently made for my side…

Sources

Related posts

By

Leave a Reply

Your email address will not be published. Required fields are marked *