diff --git a/client/common/version.go b/client/common/version.go index 4481f8bb6b..eda9365f05 100644 --- a/client/common/version.go +++ b/client/common/version.go @@ -18,5 +18,5 @@ package common const ( // SDKVersion const value for current version - SDKVersion = `2.5.3` + SDKVersion = `2.5.4` ) diff --git a/client/milvusclient/maintenance_options.go b/client/milvusclient/maintenance_options.go index b0476ac342..e4a183ffdb 100644 --- a/client/milvusclient/maintenance_options.go +++ b/client/milvusclient/maintenance_options.go @@ -84,8 +84,8 @@ func (opt *loadCollectionOption) WithRefresh(isRefresh bool) *loadCollectionOpti func NewLoadCollectionOption(collectionName string) *loadCollectionOption { return &loadCollectionOption{ collectionName: collectionName, - replicaNum: 1, - interval: time.Millisecond * 200, + // replicaNum: 1, The default value of the replicaNum should be set on the server side + interval: time.Millisecond * 200, } } @@ -156,8 +156,8 @@ func NewLoadPartitionsOption(collectionName string, partitionsNames ...string) * return &loadPartitionsOption{ collectionName: collectionName, partitionNames: partitionsNames, - replicaNum: 1, - interval: time.Millisecond * 200, + // replicaNum: 1, The default value of the replicaNum should be set on the server side + interval: time.Millisecond * 200, } } diff --git a/client/milvusclient/read_options.go b/client/milvusclient/read_options.go index de11374336..f492ba4ac2 100644 --- a/client/milvusclient/read_options.go +++ b/client/milvusclient/read_options.go @@ -56,7 +56,7 @@ type SearchOption interface { var _ SearchOption = (*searchOption)(nil) type searchOption struct { - annRequest *annRequest + annRequest *AnnRequest collectionName string partitionNames []string outputFields []string @@ -64,7 +64,7 @@ type searchOption struct { useDefaultConsistencyLevel bool } -type annRequest struct { +type AnnRequest struct { vectors []entity.Vector annField string @@ -81,8 +81,8 @@ type annRequest struct { templateParams map[string]any } -func NewAnnRequest(annField string, limit int, vectors ...entity.Vector) *annRequest { - return &annRequest{ +func NewAnnRequest(annField string, limit int, vectors ...entity.Vector) *AnnRequest { + return &AnnRequest{ annField: annField, vectors: vectors, topK: limit, @@ -91,7 +91,7 @@ func NewAnnRequest(annField string, limit int, vectors ...entity.Vector) *annReq } } -func (r *annRequest) searchRequest() (*milvuspb.SearchRequest, error) { +func (r *AnnRequest) searchRequest() (*milvuspb.SearchRequest, error) { request := &milvuspb.SearchRequest{ Nq: int64(len(r.vectors)), Dsl: r.expr, @@ -227,52 +227,52 @@ func slice2TmplValue(val any) (*schemapb.TemplateValue, error) { }, nil } -func (r *annRequest) WithANNSField(annsField string) *annRequest { +func (r *AnnRequest) WithANNSField(annsField string) *AnnRequest { r.annField = annsField return r } -func (r *annRequest) WithGroupByField(groupByField string) *annRequest { +func (r *AnnRequest) WithGroupByField(groupByField string) *AnnRequest { r.groupByField = groupByField return r } -func (r *annRequest) WithGroupSize(groupSize int) *annRequest { +func (r *AnnRequest) WithGroupSize(groupSize int) *AnnRequest { r.groupSize = groupSize return r } -func (r *annRequest) WithStrictGroupSize(strictGroupSize bool) *annRequest { +func (r *AnnRequest) WithStrictGroupSize(strictGroupSize bool) *AnnRequest { r.strictGroupSize = strictGroupSize return r } -func (r *annRequest) WithSearchParam(key, value string) *annRequest { +func (r *AnnRequest) WithSearchParam(key, value string) *AnnRequest { r.searchParam[key] = value return r } -func (r *annRequest) WithAnnParam(ap index.AnnParam) *annRequest { +func (r *AnnRequest) WithAnnParam(ap index.AnnParam) *AnnRequest { r.annParam = ap return r } -func (r *annRequest) WithFilter(expr string) *annRequest { +func (r *AnnRequest) WithFilter(expr string) *AnnRequest { r.expr = expr return r } -func (r *annRequest) WithTemplateParam(key string, val any) *annRequest { +func (r *AnnRequest) WithTemplateParam(key string, val any) *AnnRequest { r.templateParams[key] = val return r } -func (r *annRequest) WithOffset(offset int) *annRequest { +func (r *AnnRequest) WithOffset(offset int) *AnnRequest { r.offset = offset return r } -func (r *annRequest) WithIgnoreGrowing(ignoreGrowing bool) *annRequest { +func (r *AnnRequest) WithIgnoreGrowing(ignoreGrowing bool) *AnnRequest { r.ignoreGrowing = ignoreGrowing return r } @@ -422,7 +422,7 @@ type hybridSearchOption struct { collectionName string partitionNames []string - reqs []*annRequest + reqs []*AnnRequest outputFields []string useDefaultConsistency bool @@ -494,7 +494,7 @@ func (opt *hybridSearchOption) HybridRequest() (*milvuspb.HybridSearchRequest, e }, nil } -func NewHybridSearchOption(collectionName string, limit int, annRequests ...*annRequest) *hybridSearchOption { +func NewHybridSearchOption(collectionName string, limit int, annRequests ...*AnnRequest) *hybridSearchOption { return &hybridSearchOption{ collectionName: collectionName, reqs: annRequests, diff --git a/tests/go_client/testcases/database_test.go b/tests/go_client/testcases/database_test.go index 6d558ced8d..c6d0efb116 100644 --- a/tests/go_client/testcases/database_test.go +++ b/tests/go_client/testcases/database_test.go @@ -358,8 +358,15 @@ func TestDatabasePropertiesRgReplicas(t *testing.T) { prepare.FlushData(ctx, t, mc, schema.CollectionName) prepare.CreateIndex(ctx, t, mc, hp.TNewIndexParams(schema)) - _, err = mc.LoadCollection(ctx, client.NewLoadCollectionOption(schema.CollectionName)) - common.CheckErr(t, err, true) + // When load does not specify parameters, rg and replica Properties take effect + _, errLoad := mc.LoadCollection(ctx, client.NewLoadCollectionOption(schema.CollectionName)) + common.CheckErr(t, errLoad, false, "resource group not found", "service resource insufficient") + + // actually load with default rg, rg1 not existed + taskLoad, errLoad := mc.LoadCollection(ctx, client.NewLoadCollectionOption(schema.CollectionName).WithReplica(1)) + common.CheckErr(t, errLoad, true) + errLoad = taskLoad.Await(ctx) + common.CheckErr(t, errLoad, true) _, err = mc.Query(ctx, client.NewQueryOption(schema.CollectionName).WithLimit(10)) common.CheckErr(t, err, true)