Idea · Sep 28, 2026
Build Your Own Code Search Engine
Students build, in stages, a tool that answers 'where does this codebase do X?' starting from grep and BM25 over identifiers, then adding embeddings and call-graph expansion, and measure each stage on a shared benchmark of real queries.
What it would do
Coding agents now spend much of their effort just finding the right files, and tools like jevgrep sell 'find code by asking what it does.' This assignment makes students build that capability themselves and measure whether each layer actually helps. Milestone 1 tokenizes a repo into functions and splits camelCase and snake_case identifiers for a BM25 index. Milestone 2 adds docstring and comment fields and query expansion. Milestone 3 adds chunk embeddings (a small local model or an embedding API) and hybrid rank fusion. Milestone 4 builds a call graph with tree-sitter and propagates relevance to callers and callees. Every milestone is scored against a course-provided benchmark of natural-language queries with labeled target functions from two or three open-source repos, reporting recall@5 and MRR, and a final write-up asks students to explain where lexical search beats embeddings and vice versa.
Key features
- Staged milestones (BM25, field boosting, embeddings with hybrid fusion, call-graph propagation) each with a runnable CLI
- Instructor-provided benchmark of 100 or more labeled queries and an autograder that reports recall@5 and MRR per stage
- tree-sitter parsing so the same pipeline works for Python, Java, and C++ repos
- Optional agent integration: expose the search as an MCP tool and compare an agent's task success with and without it
- Error-analysis report template that forces students to categorize failed queries