Retrieval Pipeline

You will understand what a retrieval pipeline is, why it exists, and how to build a simple working version using Spring Boot and pgvector — the same stack EngineerPrep uses to power semantic question search.

Why This Matters

Picture yourself on an interview prep platform. You type: 'how do I reverse a linked list?' The app does a LIKE search against the questions table. It finds questions that contain the words 'reverse' and 'linked list'. Great. Now you type: 'flip a singly linked list' . Nothing. Zero results. The data is there. The question exists. But the words you used don't match the words in the database, so the query comes back empty. This is the core frustration of keyword search: it matches words, not meaning . Most engineers who hit this wall reach for full-text search — Postgres tsvector , Elasticsearch, that sort of thing. Those tools are better, but they still fundamentally count word overlap. They still struggle when the vocabulary doesn't match. What if the app could understand that 'flip a linked list' and 'reverse a linked list' mean the same thing…

The Simple Idea

Think about a library. You walk in and ask the librarian: 'I want a book about courage in wartime.' A good librarian doesn't scan every book title looking for the words 'courage' and 'wartime'. She thinks about what you mean and walks you to the right shelf. A retrieval pipeline is software that works the same way. It finds the most relevant stored content for a given question — based on meaning, not just matching words. Here's how it works at a high level: Step 1 — Store meaning alongside content. When you save a question like 'reverse a linked list' , you also compute a compact numerical representation of its meaning. This representation is called an embedding — a list of numbers that encodes what the text is about. You store that embedding in the database next to the question. Step 2 — Embed the query.…

See It in Action

Scene 1 — Ingestion (storing questions with meaning) Imagine a table with two columns: question text and embedding . A new question arrives: 'Reverse a linked list' . An embedding model (running on Amazon Bedrock via Spring AI) reads the text and outputs a list of numbers — something like 0.12, -0.45, 0.88, ... . The exact dimensionality depends on the model; Amazon Titan Embeddings V1, for example, produces 1,536-dimensional vectors. That list gets stored in the embedding column right next to the question text. The question is now findable by meaning, not just by keyword. --- Scene 2 — A user types a query A learner types: 'flip a singly linked list' . The same embedding model runs on this query and produces its own list of numbers — 0.10, -0.41, 0.85, ... . Notice these numbers are similar to the ones above, even though the words are completely different.…