Repository: milvus-io/milvus-sdk-go
Pull request #683 (2024-03-20 13:20:48)

fix: Rectify Weighted Rerank params
Use correct rerankType in WeightedRerank params

sre-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/milvus-io/milvus-sdk-go/pull/683#" title="Author self-approved">congqixia</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=milvus-io%2Fmilvus-sdk-go).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/milvus-io/milvus-sdk-go/blob/master/OWNERS)~~ [congqixia]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
congqixia: /kind bug
congqixia: /kind bug
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/683?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) Report
Attention: Patch coverage is `0%` with `1 lines` in your changes are missing coverage. Please review.
> Project coverage is 71.95%. Comparing base [(`8b5ef11`)](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/commit/8b5ef1126d1355dd33de8c182eefe56d55b8d92c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) to head [(`3b1821a`)](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/683?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io).
> Report is 1 commits behind head on master.

<details><summary>Additional details and impacted files</summary>


[![Impacted file tree graph](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/683/graphs/tree.svg?width=650&height=150&src=pr&token=WJK43PV390&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io)](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/683?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io)

```diff
@@           Coverage Diff           @@
##           master     #683   +/-   ##
=======================================
  Coverage   71.95%   71.95%           
=======================================
  Files          50       50           
  Lines        4649     4649           
=======================================
  Hits         3345     3345           
  Misses       1183     1183           
  Partials      121      121           
```


| [Files](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/683?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) | Coverage Δ | |
|---|---|---|
| [client/reranker.go](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/683?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io#diff-Y2xpZW50L3JlcmFua2VyLmdv) | `0.00% <0.00%> (ø)` | |

</details>

Patch:
diff --git a/client/reranker.go b/client/reranker.go
index a0cca80..ba8a41b 100644
--- a/client/reranker.go
+++ b/client/reranker.go
@@ -50,7 +50,7 @@ func (r *weightedReranker) GetParams() []*commonpb.KeyValuePair {
 	bs, _ := json.Marshal(r)
 
 	return []*commonpb.KeyValuePair{
-		{Key: rerankType, Value: rrfRerankType},
+		{Key: rerankType, Value: weightedRerankType},
 		{Key: rerankParams, Value: string(bs)},
 	}
 }
diff --git a/go.mod b/go.mod
index b0ee74e..713a20b 100644
--- a/go.mod
+++ b/go.mod
@@ -7,7 +7,7 @@ require (
 	github.com/go-faker/faker/v4 v4.1.0
 	github.com/golang/protobuf v1.5.2
 	github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
-	github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240109020841-d367b5a59df1
+	github.com/milvus-io/milvus-proto/go-api/v2 v2.4.0-rc.1
 	github.com/stretchr/testify v1.8.1
 	github.com/tidwall/gjson v1.14.4
 	google.golang.org/grpc v1.48.0
diff --git a/go.sum b/go.sum
index a2c251a..3fe2e55 100644
--- a/go.sum
+++ b/go.sum
@@ -157,8 +157,8 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k
 github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
 github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8=
 github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
-github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240109020841-d367b5a59df1 h1:oNpMivd94JAMhdSVsFw8t1b+olXz8pbzd5PES21sth8=
-github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20240109020841-d367b5a59df1/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek=
+github.com/milvus-io/milvus-proto/go-api/v2 v2.4.0-rc.1 h1:9g5pVbPiCuFBJbTKxMo3vq4N9/XdCbh8R06DKDF/V+g=
+github.com/milvus-io/milvus-proto/go-api/v2 v2.4.0-rc.1/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek=
 github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
 github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
 github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
diff --git a/mocks/MilvusServiceServer.go b/mocks/MilvusServiceServer.go
index fb41abb..3ca7c40 100644
--- a/mocks/MilvusServiceServer.go
+++ b/mocks/MilvusServiceServer.go
@@ -4537,6 +4537,61 @@ func (_c *MilvusServiceServer_UpdateCredential_Call) RunAndReturn(run func(conte
 	return _c
 }
 
+// UpdateResourceGroups provides a mock function with given fields: _a0, _a1
+func (_m *MilvusServiceServer) UpdateResourceGroups(_a0 context.Context, _a1 *milvuspb.UpdateResourceGroupsRequest) (*commonpb.Status, error) {
+	ret := _m.Called(_a0, _a1)
+
+	var r0 *commonpb.Status
+	var r1 error
+	if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.UpdateResourceGroupsRequest) (*commonpb.Status, error)); ok {
+		return rf(_a0, _a1)
+	}
+	if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.UpdateResourceGroupsRequest) *commonpb.Status); ok {
+		r0 = rf(_a0, _a1)
+	} else {
+		if ret.Get(0) != nil {
+			r0 = ret.Get(0).(*commonpb.Status)
+		}
+	}
+
+	if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.UpdateResourceGroupsRequest) error); ok {
+		r1 = rf(_a0, _a1)
+	} else {
+		r1 = ret.Error(1)
+	}
+
+	return r0, r1
+}
+
+// MilvusServiceServer_UpdateResourceGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateResourceGroups'
+type MilvusServiceServer_UpdateResourceGroups_Call struct {
+	*mock.Call
+}
+
+// UpdateResourceGroups is a helper method to define mock.On call
+//   - _a0 context.Context
+//   - _a1 *milvuspb.UpdateResourceGroupsRequest
+func (_e *MilvusServiceServer_Expecter) UpdateResourceGroups(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_UpdateResourceGroups_Call {
+	return &MilvusServiceServer_UpdateResourceGroups_Call{Call: _e.mock.On("UpdateResourceGroups", _a0, _a1)}
+}
+
+func (_c *MilvusServiceServer_UpdateResourceGroups_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.UpdateResourceGroupsRequest)) *MilvusServiceServer_UpdateResourceGroups_Call {
+	_c.Call.Run(func(args mock.Arguments) {
+		run(args[0].(context.Context), args[1].(*milvuspb.UpdateResourceGroupsRequest))
+	})
+	return _c
+}
+
+func (_c *MilvusServiceServer_UpdateResourceGroups_Call) Return(_a0 *commonpb.Status, _a1 error) *MilvusServiceServer_UpdateResourceGroups_Call {
+	_c.Call.Return(_a0, _a1)
+	return _c
+}
+
+func (_c *MilvusServiceServer_UpdateResourceGroups_Call) RunAndReturn(run func(context.Context, *milvuspb.UpdateResourceGroupsRequest) (*commonpb.Status, error)) *MilvusServiceServer_UpdateResourceGroups_Call {
+	_c.Call.Return(run)
+	return _c
+}
+
 // Upsert provides a mock function with given fields: _a0, _a1
 func (_m *MilvusServiceServer) Upsert(_a0 context.Context, _a1 *milvuspb.UpsertRequest) (*milvuspb.MutationResult, error) {
 	ret := _m.Called(_a0, _a1)


Test patch:
diff --git a/client/client_mock_test.go b/client/client_mock_test.go
index 45cd851..1f0c3ca 100644
--- a/client/client_mock_test.go
+++ b/client/client_mock_test.go
@@ -1026,3 +1026,7 @@ func (m *MockServer) HybridSearch(ctx context.Context, req *milvuspb.HybridSearc
 	status, err := SuccessStatus()
 	return &milvuspb.SearchResults{Status: status}, err
 }
+
+func (m *MockServer) UpdateResourceGroups(_ context.Context, _ *milvuspb.UpdateResourceGroupsRequest) (*commonpb.Status, error) {
+	return nil, errors.New("not implemented")
+}