Skip to content

Commit

Permalink
Fix Autoindex panic (milvus-io#24602)
Browse files Browse the repository at this point in the history
Signed-off-by: chasingegg <chao.gao@zilliz.com>
  • Loading branch information
chasingegg authored Jun 1, 2023
1 parent 5710752 commit 1a60fe4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/util/paramtable/autoindex_param.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (p *autoIndexConfig) initParams() {
}
p.indexParamsStr = p.Base.LoadWithDefault("autoIndex.params.build", "")
p.parseBuildParams(p.indexParamsStr)
p.panicIfNotInvalid()

p.SearchParamsYamlStr = p.Base.LoadWithDefault("autoIndex.params.search", "")

Expand Down
15 changes: 15 additions & 0 deletions internal/util/paramtable/autoindex_param_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ func Test_autoIndexConfig_panicIfNotInvalid(t *testing.T) {
assert.Equal(t, indexparamcheck.FloatVectorDefaultMetricType, metricType)
})

t.Run("normal case, hnsw2", func(t *testing.T) {
p := &autoIndexConfig{
Enable: true,
IndexParams: map[string]string{
common.IndexTypeKey: indexparamcheck.IndexHNSW,
"M": "30",
"efConstruction": "360",
},
}
assert.NotPanics(t, p.panicIfNotInvalid)
metricType, exist := p.IndexParams[common.MetricTypeKey]
assert.True(t, exist)
assert.Equal(t, indexparamcheck.FloatVectorDefaultMetricType, metricType)
})

t.Run("normal case, ivf flat", func(t *testing.T) {
p := &autoIndexConfig{
Enable: false,
Expand Down

0 comments on commit 1a60fe4

Please sign in to comment.