diff --git a/client/entity/field.go b/client/entity/field.go index 9ef956ff8b..3ff3f7e4f2 100644 --- a/client/entity/field.go +++ b/client/entity/field.go @@ -396,6 +396,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() diff --git a/client/entity/field_test.go b/client/entity/field_test.go index c8a967bfe6..37851d88e8 100644 --- a/client/entity/field_test.go +++ b/client/entity/field_test.go @@ -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), diff --git a/client/entity/schema.go b/client/entity/schema.go index 501ec7b9b0..8d6714bd4a 100644 --- a/client/entity/schema.go +++ b/client/entity/schema.go @@ -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