Hybrid Search

Hybrid search combines keyword matching and semantic (meaning-based) similarity so that a search engine finds the right result whether the user uses the exact right words or not.

Why This Matters

Picture this: you're a junior engineer on the EngineerPrep team. Your job today is to make the question search work well. A student types: "optimistic locking JPA" . The database has a perfect question about that — but the question was written as "handling concurrent writes with @Version in Hibernate." Not a single word overlaps. Classic keyword search returns nothing. The student leaves frustrated. So you switch to a smarter, AI-powered search that understands meaning . Now "optimistic locking JPA" correctly finds the Hibernate question. Win! But then a student types "NullPointerException" — a specific error code they copied from their stack trace. The meaning-based search struggles because that exact string appears in many questions at similar semantic distances, making it hard to rank confidently. A keyword match would have nailed it instantly. Every approach alone has a blind spot.…

The Simple Idea

Think about how a librarian finds a book for you. If you say "I want the book called 'Clean Code'" — they go straight to the catalog and look up that exact title. Fast, precise. This is keyword search : find documents that contain the exact words you typed. If you say "I want a book about writing readable software" — a good librarian doesn't look for the word 'readable.' They think about what you mean and suggest Clean Code, The Pragmatic Programmer, maybe Refactoring. This is semantic search : find documents whose meaning is close to yours, even if the words don't match. Neither approach alone is complete. Exact-match search misses synonyms and paraphrases. Meaning-based search can miss precise technical terms. Hybrid search runs both, then blends the two ranked lists into one final result. That's it. Two searches, one answer.…

See It in Action

The scene: a student searches for "distributed lock" on EngineerPrep. --- Step 1 — The query arrives. A single string, "distributed lock" , lands at the search service. Nothing has happened yet. Two workers are waiting. --- Step 2 — Keyword search runs. Worker A scans every question in the database for the words distributed and lock . It finds three questions that contain those exact words and ranks them 1, 2, 3 by how prominently the words appear. Worker A's list: - Rank 1 → Question about Redis SETNX - Rank 2 → Question about Zookeeper leases - Rank 3 → Question about database row locks --- Step 3 — Semantic search runs (in parallel). Worker B converts "distributed lock" into an embedding — a list of numbers that captures its meaning . It then measures how close that embedding is to the stored embeddings of every question. Four questions come back as meaning-close neighbors.…