Design Hybrid Search Over Case Law With Citation-Aware Ranking
Last updated: November 29, 2026
Quick Overview
Design a search system over tens of millions of court opinions and statutes that combines keyword and semantic retrieval, filters by jurisdiction and date, and ranks results using citation signals and whether an authority is still good law.
Harvey
November 29, 20260
0
0 solved
Design a search system over tens of millions of court opinions and statutes that combines keyword and semantic retrieval, filters by jurisdiction and date, and ranks results using citation signals and whether an authority is still good law.
Legal research is one of Harvey's core use cases, and answers are only as good as the authorities retrieved underneath them. The interviewer wants a retrieval architecture that respects legal filters exactly, blends lexical and dense signals, uses the citation graph, and is evaluated with lawyer-labeled relevance.
What the Interviewer Expects
- Combine BM25 and dense retrieval with a principled fusion
- Apply jurisdiction, court level, and date filters as hard constraints
- Use citation graph features and treatment (overruled, distinguished) in ranking
- Add a cross-encoder or LLM reranker over a small candidate set
- Plan incremental indexing for new opinions
- Describe offline evaluation and online quality signals
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you make sure an overruled case is never presented as controlling?
- How would you handle queries that are a pasted paragraph from a brief?
- How do you shard the vector index while keeping filters fast?
- How would you measure whether ranking changes help lawyers?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Corpus: about 15M opinions plus statutes and regulations, chunked into roughly 300M passages. Queries: natural language questions, keyword searches with quoted phrases, and pasted text. Filters: juris...
High-Level Design
- Ingestion: parse opinions, extract citations, resolve them to case ids, chunk by section with headnote context, embed passages.
- Indexes: an inverted index (BM25 with phrase support) and ...