Documentation
¶
Index ¶
- func BuildFilter(conditions map[string]interface{}) (*qdrant.Filter, error)
- type Adapter
- func (a *Adapter) CreateCollection(ctx context.Context, name string, schema *vectordb.CollectionSchema) error
- func (a *Adapter) CreateDocument(ctx context.Context, collectionName string, document *vectordb.Document) error
- func (a *Adapter) CreateDocuments(ctx context.Context, collectionName string, documents []*vectordb.Document) error
- func (a *Adapter) DeleteDocumentsByMetadata(ctx context.Context, collectionName string, metadata map[string]interface{}) error
- func (a *Adapter) GetDefaultSchema(schemaType vectordb.SchemaType, collectionName string) *vectordb.CollectionSchema
- func (a *Adapter) GetDocument(ctx context.Context, collectionName, documentID string) (*vectordb.Document, error)
- func (a *Adapter) GetSchema(ctx context.Context, collectionName string) (*vectordb.CollectionSchema, error)
- func (a *Adapter) ListCollections(ctx context.Context) ([]vectordb.CollectionInfo, error)
- func (a *Adapter) ListDocuments(ctx context.Context, collectionName string, limit int, offset int) ([]*vectordb.Document, error)
- func (a *Adapter) SearchBM25(ctx context.Context, collectionName, query string, ...) ([]*vectordb.QueryResult, error)
- func (a *Adapter) SearchByMetadata(ctx context.Context, collectionName string, metadata map[string]interface{}, ...) ([]*vectordb.QueryResult, error)
- func (a *Adapter) SearchHybrid(ctx context.Context, collectionName, query string, ...) ([]*vectordb.QueryResult, error)
- func (a *Adapter) SearchSemantic(ctx context.Context, collectionName, query string, ...) ([]*vectordb.QueryResult, error)
- func (a *Adapter) UpdateDocument(ctx context.Context, collectionName string, document *vectordb.Document) error
- func (a *Adapter) UpdateSchema(ctx context.Context, collectionName string, schema *vectordb.CollectionSchema) error
- func (a *Adapter) ValidateSchema(schema *vectordb.CollectionSchema) error
- type Client
- func (c *Client) Close() error
- func (c *Client) CollectionExists(ctx context.Context, name string) (bool, error)
- func (c *Client) CreateCollection(ctx context.Context, name string, vectorDimensions int, ...) error
- func (c *Client) CreateDocument(ctx context.Context, collectionName string, doc *Document) error
- func (c *Client) CreateDocuments(ctx context.Context, collectionName string, docs []*Document) error
- func (c *Client) DeleteAllDocuments(ctx context.Context, collectionName string) error
- func (c *Client) DeleteCollection(ctx context.Context, name string) error
- func (c *Client) DeleteDocument(ctx context.Context, collectionName string, id string) error
- func (c *Client) DeleteDocuments(ctx context.Context, collectionName string, ids []string) error
- func (c *Client) GetCollection() string
- func (c *Client) GetCollectionCount(ctx context.Context, name string) (int64, error)
- func (c *Client) GetCollectionInfo(ctx context.Context, name string) (*qdrant.GetCollectionInfoResponse, error)
- func (c *Client) GetDocument(ctx context.Context, collectionName string, id string) (*Document, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) ListCollections(ctx context.Context) ([]string, error)
- func (c *Client) ListDocuments(ctx context.Context, collectionName string, limit int) ([]*Document, error)
- func (c *Client) SearchByMetadata(ctx context.Context, collectionName string, filter *qdrant.Filter, limit int) ([]*Document, error)
- func (c *Client) SearchHybrid(ctx context.Context, collectionName string, vector []float32, ...) ([]*SearchResult, error)
- func (c *Client) SearchSemantic(ctx context.Context, collectionName string, vector []float32, topK int) ([]*SearchResult, error)
- func (c *Client) SetCollection(name string)
- func (c *Client) UpdateDocument(ctx context.Context, collectionName string, doc *Document) error
- type Config
- type Document
- type Factory
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
*Client
// contains filtered or unexported fields
}
Adapter wraps the Qdrant client to implement the vectordb.VectorDBClient interface
func NewAdapter ¶
NewAdapter creates a new Qdrant adapter from the vectordb.Config
func (*Adapter) CreateCollection ¶
func (a *Adapter) CreateCollection(ctx context.Context, name string, schema *vectordb.CollectionSchema) error
CreateCollection creates a new collection with the given schema
func (*Adapter) CreateDocument ¶
func (a *Adapter) CreateDocument(ctx context.Context, collectionName string, document *vectordb.Document) error
CreateDocument creates a new document in the specified collection
func (*Adapter) CreateDocuments ¶
func (a *Adapter) CreateDocuments(ctx context.Context, collectionName string, documents []*vectordb.Document) error
CreateDocuments creates multiple documents in batch
func (*Adapter) DeleteDocumentsByMetadata ¶
func (a *Adapter) DeleteDocumentsByMetadata(ctx context.Context, collectionName string, metadata map[string]interface{}) error
DeleteDocumentsByMetadata deletes documents matching metadata criteria
func (*Adapter) GetDefaultSchema ¶
func (a *Adapter) GetDefaultSchema(schemaType vectordb.SchemaType, collectionName string) *vectordb.CollectionSchema
GetDefaultSchema returns a default schema for the given type
func (*Adapter) GetDocument ¶
func (a *Adapter) GetDocument(ctx context.Context, collectionName, documentID string) (*vectordb.Document, error)
GetDocument retrieves a document by ID
func (*Adapter) GetSchema ¶
func (a *Adapter) GetSchema(ctx context.Context, collectionName string) (*vectordb.CollectionSchema, error)
GetSchema retrieves the schema for a collection
func (*Adapter) ListCollections ¶
ListCollections returns a list of all collections
func (*Adapter) ListDocuments ¶
func (a *Adapter) ListDocuments(ctx context.Context, collectionName string, limit int, offset int) ([]*vectordb.Document, error)
ListDocuments returns a list of documents in a collection
func (*Adapter) SearchBM25 ¶
func (a *Adapter) SearchBM25(ctx context.Context, collectionName, query string, options *vectordb.QueryOptions) ([]*vectordb.QueryResult, error)
SearchBM25 performs keyword-based search using BM25
func (*Adapter) SearchByMetadata ¶
func (a *Adapter) SearchByMetadata(ctx context.Context, collectionName string, metadata map[string]interface{}, options *vectordb.QueryOptions) ([]*vectordb.QueryResult, error)
SearchByMetadata searches documents by metadata fields
func (*Adapter) SearchHybrid ¶
func (a *Adapter) SearchHybrid(ctx context.Context, collectionName, query string, options *vectordb.QueryOptions) ([]*vectordb.QueryResult, error)
SearchHybrid performs hybrid search combining vector and keyword search
func (*Adapter) SearchSemantic ¶
func (a *Adapter) SearchSemantic(ctx context.Context, collectionName, query string, options *vectordb.QueryOptions) ([]*vectordb.QueryResult, error)
SearchSemantic performs semantic search using vector embeddings
func (*Adapter) UpdateDocument ¶
func (a *Adapter) UpdateDocument(ctx context.Context, collectionName string, document *vectordb.Document) error
UpdateDocument updates an existing document
func (*Adapter) UpdateSchema ¶
func (a *Adapter) UpdateSchema(ctx context.Context, collectionName string, schema *vectordb.CollectionSchema) error
UpdateSchema updates a collection's schema
func (*Adapter) ValidateSchema ¶
func (a *Adapter) ValidateSchema(schema *vectordb.CollectionSchema) error
ValidateSchema validates a schema definition
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Qdrant gRPC client with vector database functionality
func (*Client) CollectionExists ¶
CollectionExists checks if a collection exists
func (*Client) CreateCollection ¶
func (c *Client) CreateCollection(ctx context.Context, name string, vectorDimensions int, similarityMetric string) error
CreateCollection creates a new collection in Qdrant with the specified vector configuration Also stores embedding model metadata for later retrieval
func (*Client) CreateDocument ¶
CreateDocument inserts a single document (point) into a collection
func (*Client) CreateDocuments ¶
func (c *Client) CreateDocuments(ctx context.Context, collectionName string, docs []*Document) error
CreateDocuments inserts multiple documents (points) into a collection in batch
func (*Client) DeleteAllDocuments ¶ added in v0.7.1
DeleteAllDocuments deletes all documents from a collection
func (*Client) DeleteCollection ¶
DeleteCollection deletes a collection and all its data
func (*Client) DeleteDocument ¶
DeleteDocument deletes a document by ID
func (*Client) DeleteDocuments ¶
DeleteDocuments deletes multiple documents by IDs
func (*Client) GetCollection ¶
GetCollection returns the current default collection name
func (*Client) GetCollectionCount ¶
GetCollectionCount returns the number of points (documents) in a collection
func (*Client) GetCollectionInfo ¶
func (c *Client) GetCollectionInfo(ctx context.Context, name string) (*qdrant.GetCollectionInfoResponse, error)
GetCollectionInfo retrieves information about a collection
func (*Client) GetDocument ¶
func (c *Client) GetDocument(ctx context.Context, collectionName string, id string) (*Document, error)
GetDocument retrieves a document by ID
func (*Client) ListCollections ¶
ListCollections returns a list of all collection names
func (*Client) ListDocuments ¶
func (c *Client) ListDocuments(ctx context.Context, collectionName string, limit int) ([]*Document, error)
ListDocuments retrieves all documents in a collection using scroll
func (*Client) SearchByMetadata ¶
func (c *Client) SearchByMetadata(ctx context.Context, collectionName string, filter *qdrant.Filter, limit int) ([]*Document, error)
SearchByMetadata searches using metadata filters only
func (*Client) SearchHybrid ¶
func (c *Client) SearchHybrid(ctx context.Context, collectionName string, vector []float32, filter *qdrant.Filter, topK int) ([]*SearchResult, error)
SearchHybrid performs a hybrid search combining vector similarity and metadata filtering
func (*Client) SearchSemantic ¶
func (c *Client) SearchSemantic(ctx context.Context, collectionName string, vector []float32, topK int) ([]*SearchResult, error)
SearchSemantic performs a vector similarity search
func (*Client) SetCollection ¶
SetCollection sets the default collection name for operations
type Config ¶
type Config struct {
// Connection settings
Host string // Qdrant server host (e.g., "localhost")
Port int // Qdrant server port (default: 6334 for gRPC)
APIKey string // API key for Qdrant Cloud
UseTLS bool // Whether to use TLS (true for cloud, false for local)
// Vector settings
VectorDimensions int // Embedding vector dimensions (e.g., 1536 for OpenAI)
SimilarityMetric string // Distance metric: "Cosine", "Dot", or "Euclidean"
// Connection settings
Timeout int // Timeout in seconds for operations (default: 10)
}
Config holds Qdrant client configuration
type Document ¶
type Document struct {
ID string // Unique document ID
Vector []float32 // Embedding vector
Metadata map[string]interface{} // Payload metadata
Content string // Document content (stored in metadata)
}
Document represents a document with its vector and metadata (payload)
type Factory ¶
type Factory struct{}
Factory implements the ClientFactory interface for Qdrant
func (*Factory) CreateClient ¶
CreateClient creates a new Qdrant client
func (*Factory) GetSupportedTypes ¶
func (f *Factory) GetSupportedTypes() []vectordb.VectorDBType
GetSupportedTypes returns the list of supported database types
type SearchResult ¶
SearchResult represents a search result with a document and score