qdrant

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package qdrant provides the vector database integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements the VectorStore interface for Qdrant.

func NewClient

func NewClient(url, apiKey string) (*Client, error)

NewClient creates a new Qdrant client. URL can be in formats: "localhost:6334", "host:port", "https://cloud.qdrant.io:6334" TLS is automatically enabled for URLs containing "https://" or cloud-like domains.

func (*Client) Close

func (c *Client) Close() error

Close closes the gRPC connection.

func (*Client) CollectionExists

func (c *Client) CollectionExists(ctx context.Context, name string) (bool, error)

CollectionExists checks if a collection exists.

func (*Client) CreateCollection

func (c *Client) CreateCollection(ctx context.Context, name string, dimension int) error

CreateCollection creates a new collection if it doesn't exist.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, collectionName string, id string) error

Delete removes a point by ID.

func (*Client) Search

func (c *Client) Search(ctx context.Context, collectionName string, vector []float32, limit int, threshold float64) ([]*SearchResult, error)

Search finds the nearest neighbors for a given vector.

func (*Client) SetPayload added in v0.1.7

func (c *Client) SetPayload(ctx context.Context, collectionName string, id string, payload map[string]interface{}) error

SetPayload updates payload fields on existing points without re-uploading vectors.

func (*Client) Upsert

func (c *Client) Upsert(ctx context.Context, collectionName string, points []*Point) error

Upsert inserts or updates points in the collection.

type Point

type Point struct {
	ID      string                 `json:"id"`
	Vector  []float32              `json:"vector"`
	Payload map[string]interface{} `json:"payload"`
}

Point represents a data point in the vector database.

type SearchResult

type SearchResult struct {
	ID      string                 `json:"id"`
	Score   float32                `json:"score"`
	Payload map[string]interface{} `json:"payload"`
	Vector  []float32              `json:"vector,omitempty"`
}

SearchResult represents a single result from a similarity search.

type VectorStore

type VectorStore interface {
	// CreateCollection creates a new collection if it doesn't exist.
	CreateCollection(ctx context.Context, name string, dimension int) error

	// CollectionExists checks if a collection exists.
	CollectionExists(ctx context.Context, name string) (bool, error)

	// Upsert inserts or updates points in the collection.
	Upsert(ctx context.Context, collectionName string, points []*Point) error

	// Search finds the nearest neighbors for a given vector.
	Search(ctx context.Context, collectionName string, vector []float32, limit int, threshold float64) ([]*SearchResult, error)

	// Delete removes a point by ID.
	Delete(ctx context.Context, collectionName string, id string) error

	// SetPayload updates payload fields on existing points without re-uploading vectors.
	SetPayload(ctx context.Context, collectionName string, id string, payload map[string]interface{}) error

	// Close closes the connection to the database.
	Close() error
}

VectorStore defines the interface for vector database operations.

Jump to

Keyboard shortcuts

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