qdrant

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package qdrant implements vectorstore.VectorStore using Qdrant's REST API -- the project's non-SQL exemplar for vector backends, same role Mongo plays for state.Store -- proof the vectorstore.VectorStore interface is implementable against a real standalone vector database, not just pgvector's SQL extension).

Plain net/http against Qdrant's REST API rather than the official gRPC client (github.com/qdrant/go-client): Qdrant's REST surface is small, stable, and documented directly as JSON -- pulling in a generated gRPC client for four HTTP calls would be a heavier dependency than the problem needs.

One collection holds every tenant/namespace (not one collection per tenant or namespace): tenant_id and namespace are stored as payload fields and included in every filter, the same "always scope by tenant_id/namespace in the WHERE clause" shape pgvector uses. Qdrant point IDs must be an unsigned integer or a UUID -- never an arbitrary string -- so a caller's (tenant_id, namespace, id) is mapped to a deterministic UUID v5 (same triple always produces the same point ID, making upsert-by-id and delete-by-id idempotent) while the original three values are kept in the payload for retrieval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements vectorstore.VectorStore against a Qdrant instance.

func New

func New(baseURL, collection string, dimensions int) (*Store, error)

New creates a Qdrant-backed store. dimensions fixes the collection's vector size at creation time, same fixed-width convention as pgvector's vector(N) column -- every item upserted must supply exactly this many floats, checked before any HTTP call is made.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, namespace, id string) error

func (*Store) Init

func (s *Store) Init(ctx context.Context) error

Init creates the collection if it doesn't already exist. Safe to call on every startup -- Qdrant's create-collection endpoint 409s on an existing collection, which is treated as success. Intentionally not a numbered migration trail (unlike pgvector): Qdrant has no evolvable DDL; payload fields are schemaless.

Known limitation, same shape as pgvector's: the collection's vector size is fixed the first time it's created. Changing vector_store.dimensions in langgraph.json after the collection already exists does not migrate it -- Upsert starts failing loudly with a clear Qdrant dimension-mismatch error until the collection is manually dropped or recreated with the new size.

func (*Store) Search

func (*Store) Upsert

func (s *Store) Upsert(ctx context.Context, item *models.VectorItem) error

Upsert's created_at is a known, stated limitation: Qdrant has no built-in insert-vs-update distinction the way Postgres's ON CONFLICT DO UPDATE does, so pinning down "first write time" would need a read before every write to check whether the point already exists. created_at is set to "now" on every Upsert call, including a re-index of an already-existing id -- correct for a fresh item, but re-indexing an existing document resets its created_at rather than preserving the original. Upgrade path: a GET on the point's id before the upsert, reusing its existing created_at when present.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL