congqixia cb7f2fa6fd
enhance: Use v2 package name for pkg module (#39990)
Related to #39095

https://go.dev/doc/modules/version-numbers

Update pkg version according to golang dep version convention

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
2025-02-22 23:15:58 +08:00

29 lines
703 B
Go

package indexparamcheck
import (
"fmt"
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
"github.com/milvus-io/milvus/pkg/v2/util/typeutil"
)
// TRIEChecker checks if a TRIE index can be built.
type TRIEChecker struct {
scalarIndexChecker
}
func (c *TRIEChecker) CheckTrain(dataType schemapb.DataType, params map[string]string) error {
return c.scalarIndexChecker.CheckTrain(dataType, params)
}
func (c *TRIEChecker) CheckValidDataType(indexType IndexType, field *schemapb.FieldSchema) error {
if !typeutil.IsStringType(field.GetDataType()) {
return fmt.Errorf("TRIE are only supported on varchar field")
}
return nil
}
func newTRIEChecker() *TRIEChecker {
return &TRIEChecker{}
}