class
Qdrant::Collection
- Qdrant::Collection
- Reference
- Object
Overview
Stable facade over a Qdrant collection — the RAG working set (~5 ops).
Anti-corruption layer: request construction (the generated CreateCollection/
VectorParams/… models) is confined to this class, as is Response(T)
unwrapping (#count, #search, exists?). The public API (Collection,
Hit) depends on no generated type.
Defined in:
qdrant/collection.crConstructors
-
.new(name : String, url : String = ENV["QDRANT_URL"], api_key : String | Nil = nil)
Happy path: a remote / Cloud Qdrant → HTTPS +
api-keyheader (Qdrant's auth, not a bearer token).
Instance Method Summary
-
#count : Int64
POST /collections/{name}/points/count with
exact: true— a reliable count, used for parity and to detect divergence from the durable source. -
#delete(ids : Array(Int64)) : Nil
POST /collections/{name}/points/delete — delete by id.
-
#delete : Nil
DELETE /collections/{name} — drops the collection (the caller's
clear). -
#ensure(dim : Int32, distance : Symbol = :cosine) : Nil
PUT /collections/{name} —
collections.updatein the generated layer. - #name : String
-
#search(vector : Array(Float32), top_k : Int32 = 20) : Array(Hit)
POST /collections/{name}/points/query — bare KNN (no filter).
-
#upsert(id : Int64, vector : Array(Float32), payload : Hash(String, JSON::Any) = {} of String => JSON::Any) : Nil
PUT /collections/{name}/points —
collections.points.bulk_updatein the generated layer. -
#upsert(points : Array) : Nil
Batch upsert: an array of
{id, vector}tuples.
Constructor Detail
Happy path: a remote / Cloud Qdrant → HTTPS + api-key header (Qdrant's
auth, not a bearer token). One dedicated collection per corpus keeps ids
isolated.
Instance Method Detail
POST /collections/{name}/points/count with exact: true — a reliable count,
used for parity and to detect divergence from the durable source.
POST /collections/{name}/points/delete — delete by id. The caller owns the ids (its durable source of truth); KNN is never filtered.
DELETE /collections/{name} — drops the collection (the caller's clear).
Tolerates absence (used in spec teardown).
PUT /collections/{name} — collections.update in the generated layer.
Idempotent: a no-op when the collection already exists.
POST /collections/{name}/points/query — bare KNN (no filter). The
Response → result.points unwrapping is confined here; the generated →
home-grown type conversion lives in Hit.from. Any fusion is the caller's
job.
PUT /collections/{name}/points — collections.points.bulk_update in the
generated layer. Single upsert (payload optional and minimal for RAG:
hydration stays with the caller).