Build your own Search Engine
Full-text search over a document collection: tokenising, an inverted index, TF-IDF and BM25 ranking, and phrase queries.
- Intermediate
- About 8–16 h
- 4 checkpoints
- 4 tutorials · Python, PHP
Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.
Choose a tutorialWhy build it
Inverted indexes sit inside databases, log tools and RAG pipelines. Building one shows why lexical search still beats embeddings on exact terms, and how to measure result quality.
You will be able to
- Tokenise and normalise text.
- Build an inverted index with postings lists.
- Rank results with TF-IDF, then BM25.
- Measure result quality with precision@k on labelled queries.
Skills it exercises
- Search & Indexing Services
- Hashing & Hash Tables
- Vector Search Foundations
- RAG Retrieval Evaluation
- Data Handling
Recommended on Applied AI Engineer and System Design.
How you know you are there
Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.
- Checkpoint 1Self-check
Index
Done when: A collection of a few thousand documents is indexed into an inverted index that can be saved and loaded again.
- Checkpoint 2Self-check
Boolean queries
Done when: AND and OR queries return exactly the documents containing the terms, checked against a brute-force scan.
- Checkpoint 3Self-check
Ranking
Done when: Results are ranked with TF-IDF and with BM25, and precision@5 on 10 labelled queries is reported for both.
- Checkpoint 4Self-check
Phrases and speed
Done when: Phrase queries use positional postings, and a query over the full index answers in under 50 ms.
Stretch goals
- Combine BM25 with vector search using reciprocal rank fusion.
- A polite crawler that respects robots.txt.
Step-by-step guides
Pick one in a language you know (tutorial languages: Python, PHP). They open on the author’s site.
- Python
Building a Vector Space Indexing Engine in Python(external site)
Python: the vector space model and cosine similarity.
- Python
Finding Important Words in Text Using TF-IDF(external site)
Python: TF-IDF in a few lines.
- Python
Building a search engine using Redis and redis-py(external site)
Python: an inverted index stored in Redis.
- PHP
Code a Web Search Engine in PHP(external site)
PHP: crawler, indexer and ranking in a multi-part series.
Where to go next
- Build your own RAG Pipeline
Intermediate · 8–16 h
Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.
Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.