Data & Architecture
Vector search and RAG for your documents
Vector search finds passages that match in meaning, even when the words differ. It is the foundation for RAG, where a language model answers using your documents. We use pgvector directly in PostgreSQL or Qdrant as a separate service and make sure each user only sees results they are allowed to see.
pgvector adds vectors and similarity search to PostgreSQL; Qdrant is a standalone vector database with strong metadata filtering.
Data flow
How Vector search & RAG fits into your processes
- Documents
- Chunking
- Embeddings
- Vector index
- Language model
Use cases
What we build with Vector search & RAG
Semantic search
Search contracts, manuals and files by content instead of by keyword.
Answers with sources
Language models answer based on your documents and cite the source.
Permissions and tenants
Filter by tenant and permission within the search itself, not afterwards.
Hybrid search
Combine vectors and full text so that numbers and names are matched reliably too.
Typical projects
Why companies bring us in
- 01
Search in contracts
- Starting point
- Clauses worded in different ways need to be found across many contracts and amendments.
- Solution
- We split documents along their structure, store embeddings with pgvector and filter by tenant.
- Result
- Users find matching clauses even without the exact wording and see the location in the document.
- 02
Assistant for internal manuals
- Starting point
- Employees search for answers in manuals and policies spread across many storage locations.
- Solution
- We build RAG with hybrid search and let the language model answer only from retrieved sources.
- Result
- Answers are backed by sources, and if there is no matching source, the assistant says so.
- 03
Many tenants, strict permissions
- Starting point
- A platform with many customers wants to offer vector search without any search results leaking between tenants.
- Solution
- We filter the index by tenant and permission and test the separation automatically.
- Result
- Each user only sees results from documents they have access to.
From practice
Vector search & RAG in our projects
- Semantic search across contracts and documents of a property management platform, with pgvector in PostgreSQL.
Approach
How we introduce Vector search & RAG
- 1
Documents and questions
Which sources, which questions, which permissions apply?
- 2
Chunking and embeddings
Split text sensibly and embed it with a suitable model.
- 3
Index and filters
Set up HNSW index, metadata and permission filters.
- 4
Evaluation
Measure result quality with test questions and improve it in a targeted way.
Result
What you get from us
- Chunking strategy suited to the documents
- Embedding pipeline with recalculation on changes
- Vector index with filters by tenant and permissions
- Hybrid search combining vectors and full text
- Test set with questions and expected results
- Integration with a language model with source citations
create extension if not exists vector;
create table chunks (
id bigserial primary key,
tenant_id uuid not null,
dokument_id uuid not null,
inhalt text not null,
embedding vector(1024) not null
);
create index on chunks using hnsw (embedding vector_cosine_ops);
-- Die fünf ähnlichsten Abschnitte, nur innerhalb des Mandanten
select dokument_id, inhalt, embedding <=> $1 as abstand
from chunks
where tenant_id = $2
order by embedding <=> $1 limit 5;
Quality
What we watch for with Vector search & RAG
- 1
Chunking by structure
We split along sections and paragraphs instead of blindly cutting texts by character count.
- 2
Filters and HNSW
With strict filters, an HNSW index returns too few results; we check this and adjust the index or query.
- 3
Permissions before ranking
Results are filtered before they are passed to the language model, never only in the answer.
- 4
Model stays fixed
Switching the embedding model requires recalculating all vectors, and we plan for that.
- 5
Measure quality
We measure whether the right sections are among the top results before we tweak the prompt.
Comparison
pgvector or Qdrant?
pgvector
- Foundation
- Extension for PostgreSQL
- Data and permissions
- With domain data in one database
- Filters
- SQL, fine-tuning needed with strong filters
- Large datasets
- Good up to medium volumes
- Operations
- No additional service
Qdrant
- Foundation
- Dedicated vector database
- Data and permissions
- Metadata is carried along
- Filters
- Filters built into the index
- Large datasets
- Built for large volumes and distribution
- Operations
- Additional service
pgvector is the simpler start and keeps everything in one database. Qdrant pays off with very large numbers of vectors and complex filters.
Vector search & RAG
Common questions
Tap a question.
