Documentation
¶
Overview ¶
Package v2 provides a vectorstore implementation for Milvus using the new SDK. This package uses github.com/milvus-io/milvus/client/v2 which is actively maintained and replaces the archived milvus-sdk-go/v2 package.
Index ¶
- Variables
- type ConfigAdapter
- type Option
- func WithCollectionName(name string) Option
- func WithConsistencyLevel(level entity.ConsistencyLevel) Option
- func WithConsistencyLevelV1(level oldentity.ConsistencyLevel) Option
- func WithDropOld() Option
- func WithEF(ef int) Option
- func WithEmbedder(embedder embeddings.Embedder) Option
- func WithIndex(idx index.Index) Option
- func WithIndexV1(idx oldentity.Index) Option
- func WithMaxTextLength(num int) Option
- func WithMetaField(str string) Option
- func WithMetricType(metricType entity.MetricType) Option
- func WithMetricTypeV1(metricType oldentity.MetricType) Option
- func WithPartitionName(name string) Option
- func WithPrimaryField(str string) Option
- func WithSearchParameters(sp map[string]interface{}) Option
- func WithSearchParametersV1(sp oldentity.SearchParam) Option
- func WithShards(num int32) Option
- func WithSkipFlushOnWrite() Option
- func WithTextField(str string) Option
- func WithVectorField(str string) Option
- type Store
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmbedderWrongNumberVectors = errors.New( "number of vectors from embedder does not match number of documents", ) ErrColumnNotFound = errors.New("invalid field") ErrInvalidFilters = errors.New("invalid filters") )
var ErrInvalidOptions = errors.New("invalid options")
ErrInvalidOptions is returned when the options given are invalid.
Functions ¶
This section is empty.
Types ¶
type ConfigAdapter ¶
type ConfigAdapter struct{}
ConfigAdapter handles conversion between v1 and v2 configurations
func (ConfigAdapter) ToV2Config ¶
func (ca ConfigAdapter) ToV2Config(config interface{}) (milvusclient.ClientConfig, error)
ToV2Config converts various config types to milvusclient.ClientConfig
type Option ¶
type Option func(p *Store)
Option is a function type that can be used to modify the client.
func WithCollectionName ¶
WithCollectionName sets the collection for the milvus store.
func WithConsistencyLevel ¶
func WithConsistencyLevel(level entity.ConsistencyLevel) Option
WithConsistencyLevel sets the consistency level for the collection.
func WithConsistencyLevelV1 ¶
func WithConsistencyLevelV1(level oldentity.ConsistencyLevel) Option
WithConsistencyLevelV1 sets the consistency level from v1 type (compatibility).
func WithEmbedder ¶
func WithEmbedder(embedder embeddings.Embedder) Option
WithEmbedder sets the embedder to use.
func WithIndexV1 ¶
WithIndexV1 sets the index from v1 type (compatibility).
func WithMaxTextLength ¶
WithMaxTextLength sets the maximum length of the text field in the collection.
func WithMetaField ¶
WithMetaField sets the name of the meta field in the collection schema. default is 'meta'.
func WithMetricType ¶
func WithMetricType(metricType entity.MetricType) Option
WithMetricType sets the metric type for the vector field.
func WithMetricTypeV1 ¶
func WithMetricTypeV1(metricType oldentity.MetricType) Option
WithMetricTypeV1 sets metric type from v1 type (compatibility).
func WithPartitionName ¶
WithPartitionName sets the milvus partition for the collection.
func WithPrimaryField ¶
WithPrimaryField sets the name of the primary field in the collection schema.
func WithSearchParameters ¶
WithSearchParameters sets the search parameters.
func WithSearchParametersV1 ¶
func WithSearchParametersV1(sp oldentity.SearchParam) Option
WithSearchParametersV1 sets search parameters from v1 type (compatibility).
func WithShards ¶
WithShards sets the number of shards for the collection.
func WithSkipFlushOnWrite ¶
func WithSkipFlushOnWrite() Option
WithSkipFlushOnWrite sets the skip flush on write flag.
func WithTextField ¶
WithTextField sets the name of the text field in the collection schema.
func WithVectorField ¶
WithVectorField sets the name of the vector field in the collection schema.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a wrapper around the milvus client using the new SDK.
func New ¶
New creates an active client connection to the (specified, or default) collection in the Milvus server and returns the `Store` object needed by the other accessors. Supports both v1 (client.Config) and v2 (milvusclient.ClientConfig) configurations for compatibility.