Go · 2026

search-engine-go

A small, thread-safe document search engine in Go, built on an inverted index.

The smallest search engine that is still honest about concurrency: an in-memory inverted index behind a sync.RWMutex, so searches run in parallel while documents are added, updated and removed.

How it works

  1. Text is lowercased and split on whitespace.
  2. Each word maps to the documents that contain it.
  3. A match in the title scores two points, one in the body scores one.
  4. Results come back sorted by score.

It came before sift: the same question, answered with words instead of vectors.