From b0f4b904cd0d99f47f825fcc4def0b9987c4692c Mon Sep 17 00:00:00 2001 From: groot Date: Wed, 14 May 2025 16:34:22 +0800 Subject: [PATCH] enhance: add multiAnalyzerParams for Go SDK (#41814) relate: https://github.com/milvus-io/milvus/issues/41213 Signed-off-by: yhmo --- client/entity/field.go | 9 +++++++++ client/entity/field_test.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client/entity/field.go b/client/entity/field.go index ff744bd4f9..ef9c885902 100644 --- a/client/entity/field.go +++ b/client/entity/field.go @@ -398,6 +398,15 @@ func (f *Field) WithAnalyzerParams(params map[string]any) *Field { return f } +func (f *Field) WithMultiAnalyzerParams(params map[string]any) *Field { + if f.TypeParams == nil { + f.TypeParams = make(map[string]string) + } + bs, _ := json.Marshal(params) + f.TypeParams["multi_analyzer_params"] = string(bs) + return f +} + func (f *Field) WithEnableMatch(enable bool) *Field { if f.TypeParams == nil { f.TypeParams = make(map[string]string) diff --git a/client/entity/field_test.go b/client/entity/field_test.go index 37851d88e8..29481be28a 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{}).WithEnableMatch(true), + NewField().WithName("varchar_text").WithDataType(FieldTypeVarChar).WithMaxLength(65535).WithEnableAnalyzer(true).WithAnalyzerParams(map[string]any{}).WithMultiAnalyzerParams(map[string]any{}).WithEnableMatch(true), NewField().WithName("default_value_bool").WithDataType(FieldTypeBool).WithDefaultValueBool(true), NewField().WithName("default_value_int").WithDataType(FieldTypeInt32).WithDefaultValueInt(1),