fix: [GoSDK] Unify AnnRequest creation and fix nil map (#39665)

Related to #39559

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2025-02-07 10:34:44 +08:00 committed by GitHub
parent d7c07d16d3
commit 0bac4d3f2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,6 +85,7 @@ func NewAnnRequest(annField string, limit int, vectors ...entity.Vector) *annReq
annField: annField,
vectors: vectors,
topK: limit,
searchParam: make(map[string]string),
templateParams: make(map[string]any),
}
}
@ -358,12 +359,7 @@ func (opt *searchOption) WithSearchParam(key, value string) *searchOption {
func NewSearchOption(collectionName string, limit int, vectors []entity.Vector) *searchOption {
return &searchOption{
annRequest: &annRequest{
vectors: vectors,
searchParam: make(map[string]string),
topK: limit,
templateParams: make(map[string]any),
},
annRequest: NewAnnRequest("", limit, vectors...),
collectionName: collectionName,
useDefaultConsistencyLevel: true,
consistencyLevel: entity.ClBounded,