milvus/pkg/util/indexparamcheck/bin_ivf_flat_checker.go
Cai Yudong 8dc16b599b
Add binary metric types SUBSTRUCTURE/SUPERSTRUCTURE back (#26766)
Signed-off-by: Yudong Cai <yudong.cai@zilliz.com>
2023-08-31 20:07:00 +08:00

34 lines
721 B
Go

package indexparamcheck
import (
"fmt"
)
type binIVFFlatChecker struct {
binaryVectorBaseChecker
}
func (c binIVFFlatChecker) StaticCheck(params map[string]string) error {
if !CheckStrByValues(params, Metric, BinIvfMetrics) {
return fmt.Errorf("metric type not found or not supported, supported: %v", BinIvfMetrics)
}
if !CheckIntByRange(params, NLIST, MinNList, MaxNList) {
return errOutOfRange(NLIST, MinNList, MaxNList)
}
return nil
}
func (c binIVFFlatChecker) CheckTrain(params map[string]string) error {
if err := c.binaryVectorBaseChecker.CheckTrain(params); err != nil {
return err
}
return c.StaticCheck(params)
}
func newBinIVFFlatChecker() IndexChecker {
return &binIVFFlatChecker{}
}