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