One signed binary. Every feature compiled in. Free to run. Install Crowkis →
← back to the Roost
guidesJune 10, 2026· 5 min read

Self-hosted RAG in twenty lines with CDOC

Add documents, auto-chunk them, search with metadata filters and reranking — a working retrieval pipeline without a separate vector database.

If your corpus fits a cache, you don't need a separate vector database to do retrieval. CDOC gives you add, chunk, filter, and rerank inside Crowkis, sharing the bundled embedder — so a RAG pipeline is twenty lines, not a second service.

ingest with auto-chunking + metadata
from crowkis import CrowkisClient
db = CrowkisClient(host="127.0.0.1", port=6379, tenant="docs")

# auto-chunk a long doc into overlapping passages, attach metadata
db.cdoc_add(
    id="policy-2026",
    text=long_policy_text,
    chunk=512, overlap=64,
    meta={"team": "legal", "year": "2026"},
)
search with a filter + rerank
# filtered ANN search, reranked by the bundled cross-encoder
results = db.cdoc_search(
    "how long is the refund window?",
    k=5,
    filter={"team": "legal"},
    rerank=True,
)
for r in results:
    print(r.score, r.id, r.text[:80])   # [id, text, score] triples

Field-level filters narrow the search before it runs, and the optional rerank pass — the same cross-encoder that lifts the memory benchmarks — sharpens the ordering. Your documents are embedded and searched locally, which matters when the documents are contracts or tickets you can't ship to a hosted API.

In plain words: Add documents, search them by meaning with filters, get reranked results — all inside Crowkis, with nothing leaving your machine and no separate vector DB to run.