mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
enhance: [GoSDK] Add WithEnableMatch syntactic sugar (#39837)
Related to #35922 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
41dc1a705b
commit
f391ea136e
@ -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()
|
||||
|
||||
@ -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…
x
Reference in New Issue
Block a user