Skip to content

Commit 94bca33

Browse files
authored
feat(vectordb): Add database-agnostic vector search abstraction (#27)
* feat: Decouple filter types from Qdrant-specific implementation * chore: refactor qdrant to decouple vectordb types from Qdrant * chore: minor improvements * chore: fix search to return partial results
1 parent 40e4e19 commit 94bca33

15 files changed

Lines changed: 1996 additions & 2263 deletions

docs/v1/qdrant.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Core Features:
1919
- Vector similarity search with abstracted SearchResult interface
2020
- Type\-safe collection creation and existence checks
2121
- Support for payload metadata and optional vector retrieval
22-
- Extensible abstraction layer for alternate vector stores \(e.g., Pinecone, Postgres\)
22+
- Extensible abstraction layer for alternate vector stores \(e.g. pgVector\)
2323

2424
Basic Usage:
2525

v1/qdrant/client.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ func NewQdrantClient(p QdrantParams) (*QdrantClient, error) {
9797
//
9898
// It should be lightweight and fast — typically used during startup or readiness probes.
9999
func (c *QdrantClient) healthCheck() error {
100+
if !c.started {
101+
return fmt.Errorf("[Qdrant] client not started")
102+
}
103+
100104
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
101105
defer cancel()
102106

@@ -114,15 +118,25 @@ func (c *QdrantClient) healthCheck() error {
114118
return nil
115119
}
116120

121+
// Client returns the underlying Qdrant SDK client.
122+
// This is useful for direct access to low-level operations.
123+
func (c *QdrantClient) Client() *qdrant.Client {
124+
return c.api
125+
}
126+
117127
// Close ──────────────────────────────────────────────────────────────
118128
// Close
119129
// ──────────────────────────────────────────────────────────────
120130
//
121131
// Close gracefully shuts down the Qdrant client.
122132
//
123-
// Since the official Qdrant Go SDK doesnt maintain persistent connections,
133+
// Since the official Qdrant Go SDK doesn't maintain persistent connections,
124134
// this is currently a no-op. It exists for lifecycle symmetry and future safety.
125135
func (c *QdrantClient) Close() error {
136+
if !c.started {
137+
return nil
138+
}
139+
126140
log.Println("[Qdrant] closing client (no-op)")
127141
return nil
128142
}

v1/qdrant/configs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ type Config struct {
3131
// Optional authentication token for secured deployments.
3232
ApiKey string `yaml:"api_key" env:"QDRANT_API_KEY"`
3333

34+
// ────────────────────────────────────────────────────────────────────────────
35+
// Connection Settings
36+
// ────────────────────────────────────────────────────────────────────────────
37+
// Note: The following fields are reserved for future use.
38+
// They are not currently passed to the Qdrant SDK client.
39+
3440
// Maximum request duration before timing out.
3541
Timeout time.Duration `yaml:"timeout" env:"QDRANT_TIMEOUT"`
3642

0 commit comments

Comments
 (0)