milvus/pkg/util/indexparamcheck/hnsw_checker.go
Jiquan Long 29ae1229b6
Support AutoIndex (#24387)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
2023-05-29 20:35:28 +08:00

29 lines
741 B
Go

package indexparamcheck
type hnswChecker struct {
floatVectorBaseChecker
}
func (c hnswChecker) StaticCheck(params map[string]string) error {
if !CheckIntByRange(params, EFConstruction, HNSWMinEfConstruction, HNSWMaxEfConstruction) {
return errOutOfRange(EFConstruction, HNSWMinEfConstruction, HNSWMaxEfConstruction)
}
if !CheckIntByRange(params, HNSWM, HNSWMinM, HNSWMaxM) {
return errOutOfRange(HNSWM, HNSWMinM, HNSWMaxM)
}
return c.floatVectorBaseChecker.staticCheck(params)
}
func (c hnswChecker) CheckTrain(params map[string]string) error {
if err := c.StaticCheck(params); err != nil {
return err
}
return c.floatVectorBaseChecker.CheckTrain(params)
}
func newHnswChecker() IndexChecker {
return &hnswChecker{}
}