qdrant

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package qdrant implements vectorsearch.Index against a Qdrant vector database over its REST API. Using REST avoids vendoring the Qdrant gRPC client and its protobuf descriptors; the surface area we need is small.

Filter contract: QueryRequest.Filter is interpreted as a JSON-serializable value (typically map[string]any) and forwarded verbatim as the "filter" field of the search request body. See https://qdrant.tech/documentation/concepts/filtering/ for the full DSL. nil means no filter.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnexpectedStatus = platformerrors.New("qdrant returned an unexpected status code")

ErrUnexpectedStatus indicates qdrant returned a non-2xx response.

Functions

func ProvideIndex

func ProvideIndex[T any](
	ctx context.Context,
	logger logging.Logger,
	tracerProvider tracing.TracerProvider,
	metricsProvider metrics.Provider,
	cfg *Config,
	collection string,
	cb circuitbreaking.CircuitBreaker,
) (vectorsearch.Index[T], error)

ProvideIndex builds a qdrant-backed vectorsearch.Index. The constructor performs an idempotent collection-creation step (PUT /collections/{name}); existing collections with the same name and shape are left untouched.

Types

type Config

type Config struct {
	BaseURL   string                      `env:"BASE_URL"  json:"baseURL"`
	APIKey    string                      `env:"API_KEY"   json:"apiKey,omitempty"`
	Metric    vectorsearch.DistanceMetric `env:"METRIC"    envDefault:"cosine"     json:"metric"`
	Timeout   time.Duration               `env:"TIMEOUT"   envDefault:"30s"        json:"timeout"`
	Dimension int                         `env:"DIMENSION" json:"dimension"`
}

Config configures the qdrant-backed vectorsearch.Index. The provider speaks REST, so BaseURL must point at the qdrant HTTP endpoint (default port 6333), not the gRPC port.

func (*Config) ValidateWithContext

func (cfg *Config) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a Config struct.

Jump to

Keyboard shortcuts

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