mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
51fe4743f1
this hints the user passed invalid metric type in error message, so users could know what's wrong Signed-off-by: yah01 <yang.cen@zilliz.com>
34 lines
740 B
Go
34 lines
740 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 %s not found or not supported, supported: %v", params[Metric], 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{}
|
|
}
|