Scrivio Interview library
DesignAdvanced6 min read · updated 12 November 2026

Several teams are building RAG features with their own vector stores and ingestion code. Design a shared retrieval platform for Java teams.

I would build a retrieval platform with three products: managed ingestion connectors with sensible chunking defaults and a versioned embedding service, a retrieval API that enforces access control centrally, and shared evaluation tooling with datasets per use case. It would run on a small set of vector store options, often the PostgreSQL with pgvector the company already operates, and have a clear owning team, published SLOs and cost allocation per consuming team.

Why this question is asked

When several teams build RAG features on their own, the company ends up with five vector databases, five ingestion scripts that each read the same wiki differently, and five slightly different ways of checking permissions, at least one of them wrong. Each team also relearns the same lessons about chunking and evaluation. Interviewers ask staff and principal engineers this question to see whether they can find the right platform boundary: shared where the work is the same, flexible where use cases genuinely differ. In this answer, we will look at what the teams duplicate, design ingestion and embedding as a service, design the retrieval API with central access control, choose storage, add evaluation, and set ownership and cost rules.

1What the Teams Are Duplicating

Looking across teams, the work splits into two kinds. Some of it is identical everywhere: connecting to Confluence, SharePoint, Jira or Git; extracting text from PDFs and Word files; splitting it into chunks; calling an embedding model; keeping the index in sync when documents change; and checking whether a user may see a chunk. Other work is specific to each feature: the prompt, the choice of sources, how answers are shown, and what good looks like for this use case.

A platform should take over the first kind completely and leave the second kind to teams. Getting that boundary wrong in either direction fails. A platform that only offers a vector database leaves teams duplicating ingestion and permissions; a platform that also owns prompts and answer generation becomes a bottleneck for every product change.

2Managed Ingestion and a Versioned Embedding Service

Ingestion becomes a set of managed connectors. A team registers a source, for example the HR space in the wiki, and the platform reads it, keeps it in sync through change events or scheduled crawls, extracts text, applies chunking defaults that work well for that document type, and records metadata including the source's access lists. Teams can override chunking for a collection when their evaluation shows a better setting, but they start from a tested default instead of a guess.

Embedding is a service with versions. The platform exposes embedding models under version names such as embed-v3, records the version with every chunk, and never mixes vectors from different versions in one index. When a better model is adopted, the platform builds a new index in the background, re-embeds the collection, runs the collection's evaluation set against both, and moves the collection's readers to the new version only when results are at least as good.

Step throughThe shared retrieval platform
  1. Team featuresprompts, answer UI, source choice; owned by teams
  2. Retrieval APIsearch with central access control, hybrid + rerank
  3. Evaluation servicedatasets per use case, recall and answer checks
  4. Embedding serviceversioned models, embed-v3, embed-v4
  5. Ingestion connectorswiki, tickets, documents, code; sync and ACLs
  6. StoragePostgreSQL + pgvector; one search engine for keyword

6 layers, from the top down. Step through them one at a time.

Teams own the top layer; the platform owns everything below it.

3A Retrieval API With Central Access Control

Teams do not query the vector store directly. They call a retrieval API with the question, the collections to search and the end user's identity, passed as the user's token or a verified identity from the calling service. The platform resolves the user's groups, builds the permission filter itself and applies it inside the search, so no team can forget it or get it subtly wrong. It also runs hybrid keyword and vector search and optional reranking.

Java
POST /retrieval/v1/search
Authorization: Bearer <service token>
X-End-User: <signed end-user token>
{ "collections": ["hr-policies", "it-howto"], "query": "How do I request parental leave?",
"topK": 5, "rerank": true }
200 OK
{ "results": [
{ "chunkId": "hr-policies/leave-2025#3", "docTitle": "Leave Policy", "score": 0.87,
"text": "Parental leave is requested in the HR portal ...", "url": "https://wiki/..." }
],
"embeddingVersion": "embed-v3", "filteredOut": "not disclosed" }

Notice that the response does not reveal how many chunks were removed by the permission filter, because even that number can leak the existence of documents. A small Spring Boot client library wraps the API and plugs into Spring AI as a DocumentRetriever, so teams can use it inside RetrievalAugmentationAdvisor with a few lines of configuration.

4Choosing a Small Set of Storage Options

Every additional vector database is another system to secure, back up, monitor and upgrade. Most companies already run PostgreSQL well, and pgvector with HNSW indexes handles millions of chunks per collection with good latency, while keeping metadata, permissions and chunks in one transactional store. So I would make PostgreSQL with pgvector the default, plus at most one other option for cases it cannot serve, for example the company's existing search engine for very large collections or strong keyword search. Teams that think they need a third system bring the evaluation numbers that prove it.

5Shared Evaluation Tooling

The platform cannot know what a good answer is for each feature, but it can make evaluation easy. It offers a place to store a labelled dataset per use case: real questions, the documents that should be retrieved, and key facts the answer must contain. It runs retrieval metrics such as recall at 5 automatically on every platform change, such as a new chunking default or embedding version, and teams can run answer-level checks on their own pipelines. Because the platform changes underneath many teams, these per-collection evaluation sets are also its regression tests: a platform release that lowers a team's recall is not released.

6Ownership, SLOs and Cost

A platform without a clear owner decays. One team owns ingestion, embedding, retrieval and evaluation tooling, with on-call. It publishes SLOs, for example search p95 under 300 milliseconds and 99.9 percent availability, and a freshness SLO, such as changed documents searchable within 15 minutes, since stale answers are a common complaint. Costs of embedding, storage and reranking are measured per collection and allocated to the consuming teams, which keeps usage honest and funds the platform. The adoption path matters too: the platform team migrates one or two existing RAG features first, proves that they got better or cheaper, and only then asks others to move.

Step throughOnboarding a team's new use case
  1. Register sources as collectionsconnector, owner, data class
  2. Ingest with chunking defaultsembed-v3, ACLs captured
  3. Team adds a labelled dataset50 to 200 real questions
  4. Recall at 5 meets the target?
    YesIntegrate via retrieval APINoTune chunking or add hybrid
  5. Monitor freshness, latency, costagainst published SLOs

5 steps in order. Play them, or step through them one at a time.

7Follow-up questions

What if a team needs a different chunking strategy?

They override it per collection, and the evaluation set shows whether it helps. If several teams converge on the same override for a document type, it becomes the new default. The platform should make changing the setting easy and measuring it mandatory.

Should the platform also generate answers?

Usually not at first. Prompts and answer behaviour change with each product and are where teams differentiate. The platform can offer a reference generation component, but making it mandatory would turn every product change into a platform request.

How do you handle sources with very sensitive data, such as HR cases?

Through the data classification of each collection. Some sources are not ingested at all, some only into collections that specific user groups can search, and the platform's connectors refuse to ingest a source whose access lists cannot be captured, since central access control only works if every chunk has correct permissions.

8Conclusion

In this answer, we split the teams' work into what is the same everywhere and what is specific. The platform took the common part: managed ingestion connectors with chunking defaults, a versioned embedding service, a retrieval API that enforces access control centrally with hybrid search and reranking, a small set of storage options led by PostgreSQL with pgvector, and shared evaluation datasets that also guard platform changes. Teams kept prompts and product behaviour, and a single owning team ran the platform with SLOs and cost allocation.

What to say in the interviewAbout 80 seconds aloud

Open with

I would start by separating what every team does the same way from what is specific to each feature. Connecting to sources, extracting text, chunking, embedding, keeping the index in sync and checking permissions are the same everywhere, so the platform owns those.

Then, if they want more

Prompts, source choice and the user experience stay with teams.

Concretely, the platform offers managed ingestion connectors for things like the wiki, ticketing system and document stores, with tested chunking defaults per document type that teams can override, and a versioned embedding service, so every chunk records its embedding version and model upgrades are background re-indexing jobs that are evaluated before switching.

Teams search through a retrieval API that takes the end user's identity and applies the permission filter inside the query, so nobody can forget it; it also does hybrid keyword and vector search and reranking, and I would wrap it as a Spring AI document retriever.

For storage I would default to PostgreSQL with pgvector, which we already operate, plus at most one other option. Each use case keeps a labelled question set in the shared evaluation tooling, which also acts as the platform's regression tests. Finally, one team owns it with on-call, latency and freshness SLOs, and costs are allocated to consuming teams per collection.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring AI reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Several teams are building RAG features with their own vector stores and ingestion code....": https://scrivio-interview-library.netlify.app/spring-boot/spring-ai/01cd8cb41e/