milvus/pkg/util/indexparamcheck/raft_ivf_flat_checker.go
cqy123456 b31d1a1eb5
enhance: add addition index params for raft index (#30179)
issue: https://github.com/milvus-io/milvus/issues/29230

Signed-off-by: yusheng.ma <yusheng.ma@zilliz.com>
Co-authored-by: yusheng.ma <yusheng.ma@zilliz.com>
2024-02-26 14:50:54 +08:00

31 lines
875 B
Go

package indexparamcheck
import "fmt"
// raftIVFChecker checks if a RAFT_IVF_Flat index can be built.
type raftIVFFlatChecker struct {
ivfBaseChecker
}
// CheckTrain checks if ivf-flat index can be built with the specific index parameters.
func (c *raftIVFFlatChecker) CheckTrain(params map[string]string) error {
if err := c.ivfBaseChecker.CheckTrain(params); err != nil {
return err
}
if !CheckStrByValues(params, Metric, RaftMetrics) {
return fmt.Errorf("metric type not found or not supported, supported: %v", RaftMetrics)
}
setDefaultIfNotExist(params, RaftCacheDatasetOnDevice, "false")
if !CheckStrByValues(params, RaftCacheDatasetOnDevice, []string{"true", "false"}) {
return fmt.Errorf("raft index cache_dataset_on_device param only support true false")
}
return nil
}
func newRaftIVFFlatChecker() IndexChecker {
return &raftIVFFlatChecker{}
}