Documentation
¶
Index ¶
- type Adapter
- func (a *Adapter) Close(ctx context.Context) error
- func (a *Adapter) CollectionExists(ctx context.Context, name string) (bool, error)
- 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) DeleteCollection(ctx context.Context, name string) error
- func (a *Adapter) DeleteDocument(ctx context.Context, collectionName, documentID string) error
- func (a *Adapter) DeleteDocuments(ctx context.Context, collectionName string, documentIDs []string) error
- func (a *Adapter) DeleteDocumentsByMetadata(ctx context.Context, collectionName string, metadata map[string]interface{}) error
- func (a *Adapter) GetCollectionCount(ctx context.Context, name string) (int64, 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) Health(ctx context.Context) 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) BatchCreateDocuments(ctx context.Context, collectionName string, docs []*Document) error
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) CollectionExists(ctx context.Context, name string) (bool, error)
- func (c *Client) CreateCollection(ctx context.Context, name string, dimensions int, similarity string) error
- func (c *Client) CreateDocument(ctx context.Context, collectionName string, doc *Document) error
- func (c *Client) DeleteAllDocuments(ctx context.Context, collectionName string) error
- func (c *Client) DeleteCollection(ctx context.Context, name string, deleteNodes bool) error
- func (c *Client) DeleteDocument(ctx context.Context, collectionName, id string) error
- func (c *Client) DeleteDocuments(ctx context.Context, collectionName string, ids []string) error
- func (c *Client) GetCollectionCount(ctx context.Context, name string) (int64, error)
- func (c *Client) GetCollectionInfo(ctx context.Context, name string) (map[string]interface{}, error)
- func (c *Client) GetDocument(ctx context.Context, collectionName, 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) UpdateDocument(ctx context.Context, collectionName string, doc *Document) error
- func (c *Client) VectorSearch(ctx context.Context, collectionName string, vector []float32, limit int) ([]*QueryResult, error)
- func (c *Client) VectorSearchWithFilter(ctx context.Context, collectionName string, vector []float32, limit int, ...) ([]*QueryResult, error)
- type Config
- type Document
- type Factory
- type QueryResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter wraps the Neo4j client to implement the vectordb.VectorDBClient interface
func (*Adapter) CollectionExists ¶
CollectionExists checks if a collection exists
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) DeleteCollection ¶
DeleteCollection deletes a collection and all its documents
func (*Adapter) DeleteDocument ¶
DeleteDocument deletes a document by ID
func (*Adapter) DeleteDocuments ¶
func (a *Adapter) DeleteDocuments(ctx context.Context, collectionName string, documentIDs []string) error
DeleteDocuments deletes multiple documents by IDs
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) GetCollectionCount ¶
GetCollectionCount returns the number of documents in a collection
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 (not supported by Neo4j)
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 (not supported by Neo4j)
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 the schema for a collection (not fully supported)
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 Neo4j driver to provide vector database operations
func (*Client) BatchCreateDocuments ¶
func (c *Client) BatchCreateDocuments(ctx context.Context, collectionName string, docs []*Document) error
BatchCreateDocuments creates multiple documents in a single transaction
func (*Client) CollectionExists ¶
CollectionExists checks if a vector index exists for the given collection name
func (*Client) CreateCollection ¶
func (c *Client) CreateCollection(ctx context.Context, name string, dimensions int, similarity string) error
CreateCollection creates a new vector index for a node label In Neo4j, a "collection" maps to a node label with a vector index
func (*Client) CreateDocument ¶
CreateDocument creates a new document node with vector embedding
func (*Client) DeleteAllDocuments ¶
DeleteAllDocuments deletes all documents with the given label
func (*Client) DeleteCollection ¶
DeleteCollection deletes a vector index and optionally all nodes with the label
func (*Client) DeleteDocument ¶
DeleteDocument deletes a document by ID
func (*Client) DeleteDocuments ¶
DeleteDocuments deletes multiple documents by ID
func (*Client) GetCollectionCount ¶
GetCollectionCount returns the number of nodes with the given label
func (*Client) GetCollectionInfo ¶
func (c *Client) GetCollectionInfo(ctx context.Context, name string) (map[string]interface{}, error)
GetCollectionInfo returns metadata about a vector index
func (*Client) GetDocument ¶
GetDocument retrieves a document by ID
func (*Client) ListCollections ¶
ListCollections returns all vector indexes (collections)
func (*Client) ListDocuments ¶
func (c *Client) ListDocuments(ctx context.Context, collectionName string, limit int) ([]*Document, error)
ListDocuments returns all documents with the given label
func (*Client) UpdateDocument ¶
UpdateDocument updates an existing document
func (*Client) VectorSearch ¶
func (c *Client) VectorSearch(ctx context.Context, collectionName string, vector []float32, limit int) ([]*QueryResult, error)
VectorSearch performs vector similarity search
type Config ¶
type Config struct {
// URI is the Neo4j connection URI (e.g., bolt://localhost:7687 or neo4j://localhost:7687)
URI string
// Username for authentication (default: neo4j)
Username string
// Password for authentication
Password string
// Database name (default: neo4j)
Database string
// MaxConnections for connection pool (default: 50)
MaxConnections int
// Timeout for operations (default: 30s)
Timeout time.Duration
// VectorDimensions for vector index (default: 1536)
VectorDimensions int
// SimilarityMetric for vector search (cosine or euclidean, default: cosine)
SimilarityMetric string
}
Config represents the configuration for a Neo4j client
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a default Neo4j configuration
type Document ¶
type Document struct {
ID string // Node ID property
Content string // Text content
Vector []float32 // Embedding vector
Metadata map[string]interface{} // Additional properties
}
Document represents a document node in Neo4j
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory implements the vectordb.ClientFactory interface for Neo4j
func (*Factory) CreateClient ¶
CreateClient creates a new Neo4j client from vectordb.Config
func (*Factory) GetSupportedTypes ¶
func (f *Factory) GetSupportedTypes() []vectordb.VectorDBType
GetSupportedTypes returns the supported database types
type QueryResult ¶
QueryResult represents a vector search result