mirror of https://github.com/milvus-io/milvus.git
Cherry-pick from master pr: #39837 Related to #35922 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/39839/head
parent
16ea4fcb90
commit
aa74e8ba3d
|
@ -388,6 +388,14 @@ func (f *Field) WithAnalyzerParams(params map[string]any) *Field {
|
|||
return f
|
||||
}
|
||||
|
||||
func (f *Field) WithEnableMatch(enable bool) *Field {
|
||||
if f.TypeParams == nil {
|
||||
f.TypeParams = make(map[string]string)
|
||||
}
|
||||
f.TypeParams[TypeParamEnableMatch] = strconv.FormatBool(enable)
|
||||
return f
|
||||
}
|
||||
|
||||
// ReadProto parses FieldSchema
|
||||
func (f *Field) ReadProto(p *schemapb.FieldSchema) *Field {
|
||||
f.ID = p.GetFieldID()
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestFieldSchema(t *testing.T) {
|
|||
NewField().WithName("partition_key").WithDataType(FieldTypeInt32).WithIsPartitionKey(true),
|
||||
NewField().WithName("array_field").WithDataType(FieldTypeArray).WithElementType(FieldTypeBool).WithMaxCapacity(128),
|
||||
NewField().WithName("clustering_key").WithDataType(FieldTypeInt32).WithIsClusteringKey(true),
|
||||
NewField().WithName("varchar_text").WithDataType(FieldTypeVarChar).WithMaxLength(65535).WithEnableAnalyzer(true).WithAnalyzerParams(map[string]any{}),
|
||||
NewField().WithName("varchar_text").WithDataType(FieldTypeVarChar).WithMaxLength(65535).WithEnableAnalyzer(true).WithAnalyzerParams(map[string]any{}).WithEnableMatch(true),
|
||||
|
||||
NewField().WithName("default_value_bool").WithDataType(FieldTypeBool).WithDefaultValueBool(true),
|
||||
NewField().WithName("default_value_int").WithDataType(FieldTypeInt32).WithDefaultValueInt(1),
|
||||
|
|
|
@ -33,6 +33,9 @@ const (
|
|||
// TypeParamMaxCapacity is the const for array type max capacity
|
||||
TypeParamMaxCapacity = `max_capacity`
|
||||
|
||||
// TypeParamEnableMatch is the const for enable text match
|
||||
TypeParamEnableMatch = `enable_match`
|
||||
|
||||
// ClStrong strong consistency level
|
||||
ClStrong ConsistencyLevel = ConsistencyLevel(commonpb.ConsistencyLevel_Strong)
|
||||
// ClBounded bounded consistency level with default tolerance of 5 seconds
|
||||
|
|
Loading…
Reference in New Issue