Repository: milvus-io/milvus-sdk-go
Pull request #597 (2023-10-16 03:25:46)

Fix SCANN index type used ivf_flat value
See also #594
/kind bug

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/597#" 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":[]} -->
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/597?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) Report
> Merging [#597](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/597?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) (dccf3a8) into [master](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/commit/b1c9ccbfe772cbf2940fbef722544ba58116c39b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) (b1c9ccb) will **not change** coverage.
> Report is 3 commits behind head on master.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/597/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/597?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     #597   +/-   ##
=======================================
  Coverage   82.92%   82.92%           
=======================================
  Files          40       40           
  Lines        3643     3643           
=======================================
  Hits         3021     3021           
  Misses        511      511           
  Partials      111      111           
```


| [Files](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/597?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) | Coverage Δ | |
|---|---|---|
| [entity/indexes\_gen.go](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/597?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io#diff-ZW50aXR5L2luZGV4ZXNfZ2VuLmdv) | `99.25% <100.00%> (ø)` | |
| [entity/indexes\_search\_param\_gen.go](https://app.codecov.io/gh/milvus-io/milvus-sdk-go/pull/597?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io#diff-ZW50aXR5L2luZGV4ZXNfc2VhcmNoX3BhcmFtX2dlbi5nbw==) | `98.34% <ø> (ø)` | |


Patch:
diff --git a/entity/genidx/genidx.go b/entity/genidx/genidx.go
index 2f997be..b99dad7 100644
--- a/entity/genidx/genidx.go
+++ b/entity/genidx/genidx.go
@@ -710,7 +710,7 @@ func main() {
 			},
 			{
 				IdxName: "SCANN",
-				IdxType: entity.IvfFlat,
+				IdxType: entity.SCANN,
 				ConstructParams: []idxParam{
 					{
 						Name:           "nlist",
diff --git a/entity/indexes_gen.go b/entity/indexes_gen.go
index 0604c5b..e4b84fe 100755
--- a/entity/indexes_gen.go
+++ b/entity/indexes_gen.go
@@ -727,7 +727,7 @@ func NewIndexGPUIvfPQ(metricType MetricType,
 
 var _ Index = &IndexSCANN{}
 
-// IndexSCANN idx type for IVF_FLAT
+// IndexSCANN idx type for SCANN
 type IndexSCANN struct { //auto generated fields
 	nlist int
 	with_raw_data bool
@@ -741,7 +741,7 @@ func(i *IndexSCANN) Name() string {
 
 // IndexType returns IndexType, implementing Index interface
 func(i *IndexSCANN) IndexType() IndexType {
-	return IndexType("IVF_FLAT")
+	return IndexType("SCANN")
 }
 
 // SupportBinary returns whether index type support binary vector
diff --git a/entity/indexes_search_param_gen.go b/entity/indexes_search_param_gen.go
index a5a8148..1a8b6b2 100755
--- a/entity/indexes_search_param_gen.go
+++ b/entity/indexes_search_param_gen.go
@@ -382,7 +382,7 @@ func NewIndexGPUIvfPQSearchParam(
 
 var _ SearchParam = &IndexSCANNSearchParam{}
 
-// IndexSCANNSearchParam search param struct for index type IVF_FLAT
+// IndexSCANNSearchParam search param struct for index type SCANN
 type IndexSCANNSearchParam struct { //auto generated fields
 	baseSearchParams
 	


Test patch:
diff --git a/entity/indexes_gen_test.go b/entity/indexes_gen_test.go
index cec8afb..e7fce9f 100755
--- a/entity/indexes_gen_test.go
+++ b/entity/indexes_gen_test.go
@@ -588,7 +588,7 @@ func TestIndexSCANN(t *testing.T){
 		assert.Nil(t, err)
 		assert.NotNil(t, idx0)
 		assert.Equal(t, "SCANN", idx0.Name())
-		assert.EqualValues(t, "IVF_FLAT", idx0.IndexType())
+		assert.EqualValues(t, "SCANN", idx0.IndexType())
 		assert.NotNil(t, idx0.Params())
 		assert.False(t, idx0.SupportBinary())
 		
@@ -600,7 +600,7 @@ func TestIndexSCANN(t *testing.T){
 		assert.Nil(t, err)
 		assert.NotNil(t, idx1)
 		assert.Equal(t, "SCANN", idx1.Name())
-		assert.EqualValues(t, "IVF_FLAT", idx1.IndexType())
+		assert.EqualValues(t, "SCANN", idx1.IndexType())
 		assert.NotNil(t, idx1.Params())
 		assert.False(t, idx1.SupportBinary())