enhance: add multiAnalyzerParams for Go SDK (#41814)

relate: https://github.com/milvus-io/milvus/issues/41213

Signed-off-by: yhmo <yihua.mo@zilliz.com>
This commit is contained in:
groot 2025-05-14 16:34:22 +08:00 committed by GitHub
parent 36e9e41627
commit b0f4b904cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -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)

View File

@ -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),