mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
enhance: [GoSDK][2.5] Cherry-pick go client 2.5.4 commits and bump version (#42708)
Cherry-pick from master pr: #41356 #41674 Co-authored-by: Mario Camou <mcamou@users.noreply.github.com> Co-authored-by: ThreadDao <yufen.zong@zilliz.com> --------- Signed-off-by: mcamou <mcamou@users.noreply.github.com> Signed-off-by: ThreadDao <yufen.zong@zilliz.com> Signed-off-by: Congqi Xia <congqi.xia@zilliz.com> Co-authored-by: Mario Camou <mcamou@users.noreply.github.com> Co-authored-by: ThreadDao <yufen.zong@zilliz.com>
This commit is contained in:
parent
2da19b3166
commit
9db6228464
@ -18,5 +18,5 @@ package common
|
||||
|
||||
const (
|
||||
// SDKVersion const value for current version
|
||||
SDKVersion = `2.5.3`
|
||||
SDKVersion = `2.5.4`
|
||||
)
|
||||
|
||||
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user