Vector databases¶
The vector DB stores one vector per chunk, with a small payload. Everything else (documents, chunk text, metadata, the keyword index) lives in Postgres, so the vector DB can be swapped without losing data.
Pick one with VECTOR_DB_BACKEND, install its extra, and set
VECTOR_DB_URL for a server, or leave it empty for embedded mode.
Backends¶
VECTOR_DB_BACKEND |
Extra | Modes |
|---|---|---|
QDRANT (default) |
included | Embedded (a local folder), server, Qdrant Cloud |
CHROMA |
chroma |
Embedded, server |
PINECONE |
pinecone |
Serverless (PINECONE_CLOUD, PINECONE_REGION) |
WEAVIATE |
weaviate |
Server, Weaviate Cloud |
MILVUS |
milvus |
Milvus Lite (embedded), server |
PGVECTOR |
pgvector |
Postgres with the vector extension (the Compose Postgres has it) |
FAISS |
faiss |
Embedded |
LANCEDB |
lancedb |
Embedded, LanceDB Cloud |
ELASTICSEARCH |
elasticsearch |
Server |
Connection examples¶
VECTOR_DB_BACKEND="QDRANT" # or CHROMA, MILVUS, FAISS, LANCEDB
VECTOR_DB_URL=
VECTOR_DB_PATH="vector_db"
Data lives under src/assets/database/<VECTOR_DB_PATH>/<backend>/, one
folder per backend, so switching backends never mixes their files.
Embedded mode is meant for one process: run a server for several
workers or replicas.
One database for everything. The Compose Postgres image already has the extension.
# CHROMA VECTOR_DB_URL="http://localhost:8000"
# WEAVIATE VECTOR_DB_URL="http://localhost:8080" (or a Weaviate Cloud URL + API key)
# MILVUS VECTOR_DB_URL="http://localhost:19530"
# LANCEDB VECTOR_DB_URL="db://my-database" (LanceDB Cloud, needs an API key)
# ELASTICSEARCH VECTOR_DB_URL="http://localhost:9200"
VECTOR_DB_URL is required for PINECONE (only the API key),
PGVECTOR and ELASTICSEARCH. WEAVIATE defaults to localhost.
Distance¶
VECTOR_DB_DISTANCE_METHOD is cosine (default) or dot. With dot, keep
EMBEDDING_NORMALIZE=true so the scores behave like cosine. A collection
keeps the distance it was created with: the setting applies to new
collections. To move an existing project over, delete its collection
(DELETE /api/v1/vectordb/collections/{name}), then
reindex the project, which creates it again.
What is stored¶
Each project gets its own collection, pagelore_project_<id>, unless it is
created with a collection_name. Projects that name the same collection
share it. A record holds:
- the chunk's vector, with the chunk id as its id;
- a payload with
chunk_id,project_id,document_id,file_name,chunk_index,parent_idwhen it has one, and the chunk's location (pages, headings, rows, times).
project_id and document_id are indexed for filtering. Your metadata
filters are resolved in Postgres into document ids, which limit the vector
search (see Filters). That works the same
on every backend.
Each collection also records, in Postgres, the backend, embedding model, dimension and distance that created it. A search or insert with another model is refused instead of returning wrong results.
Switching backends¶
- Change
VECTOR_DB_BACKEND(andVECTOR_DB_URL), install the extra and restart. GET /api/v1/projects/{id}/indexreportsmissingfor projects that have no collection in the new backend.POST /api/v1/projects/{id}/reindexcreates the collection and embeds the documents again from their stored text.
See Reindexing.
The raw vector DB API¶
Besides projects, /api/v1/vectordb exposes the configured vector DB
directly, for your own collections:
| Endpoint | |
|---|---|
GET /vectordb/collections |
List collections |
POST /vectordb/collections |
Create one. Leave embedding_size empty to bind it to the configured model, or set it for vectors you compute yourself (it then accepts only vectors, never text) |
GET /vectordb/collections/{name} |
Record count, details and the model it is bound to |
DELETE /vectordb/collections/{name} |
Delete it |
POST /vectordb/collections/{name}/records |
Insert up to 1000 records, each with text (embedded for you) or a vector, and a payload |
POST /vectordb/collections/{name}/search |
Search by text or vector (limit up to 100), with project_id / document_id filters |
POST /vectordb/collections/{name}/records/delete |
Delete by ids or by filters |
FAISS on macOS
torch (used by sentence-transformers and Docling) and faiss-cpu each
ship their own OpenMP runtime, and loading both in one process aborts
it ("OMP: Error #15"). With FAISS on a Mac, use FASTEMBED or a hosted
embedding provider, and the native extractor.