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 ¶
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.