@@ -181,12 +181,17 @@ func (i *implementerDocument) Query(ctx context.Context, documentIds []string, p
181
181
// If RetrieveVector is true, the vector values will be returned.
182
182
// - OutputFields: (Optional) Return columns specified by the list of column names.
183
183
// - Limit: (Required) Limit the number of documents returned (default to 1).
184
+ // - Radius: (Optional) Specifies the radius range for similarity retrieval.
185
+ // IP: return when score >= radius, value range (-∞, +∞).
186
+ // COSINE: return when score >= radius, value range [-1, 1].
187
+ // L2: return when score <= radius, value range [0, +∞).
184
188
type SearchDocumentParams struct {
185
189
Filter * Filter
186
190
Params * SearchDocParams
187
191
RetrieveVector bool
188
192
OutputFields []string
189
193
Limit int64
194
+ Radius * float32
190
195
}
191
196
192
197
// [SearchDocParams] holds the parameters for searching documents to a collection.
@@ -196,10 +201,10 @@ type SearchDocumentParams struct {
196
201
// of vectors to be accessed. Valid range is [1, nlist], and nlist is defined by creating collection.
197
202
// - Ef: (Optional) HNSW type index requires configuration parameter ef to specify the number
198
203
// of vectors to be accessed (default to 10). Valid range is [1, 32768]
199
- // - Radius: (Optional) Specifies the radius range for similarity retrieval.
200
204
type SearchDocParams struct {
201
- Nprobe uint32 `json:"nprobe,omitempty"` // 搜索时查找的聚类数量,使用索引默认值即可
202
- Ef uint32 `json:"ef,omitempty"` // HNSW
205
+ Nprobe uint32 `json:"nprobe,omitempty"` // 搜索时查找的聚类数量,使用索引默认值即可
206
+ Ef uint32 `json:"ef,omitempty"` // HNSW
207
+ // Deprecated: Radius is deprecated and should not be used, which is supported in [SearchDocumentParams].
203
208
Radius float32 `json:"radius,omitempty"` // 距离阈值,范围搜索时有效
204
209
}
205
210
@@ -694,11 +699,13 @@ func (i *implementerFlatDocument) search(ctx context.Context, databaseName, coll
694
699
req .Search .OutputFields = param .OutputFields
695
700
req .Search .Limit = param .Limit
696
701
702
+ req .Search .Params = new (document.SearchParams )
697
703
if param .Params != nil {
698
- req .Search .Params = new (document.SearchParams )
699
704
req .Search .Params .Nprobe = param .Params .Nprobe
700
705
req .Search .Params .Ef = param .Params .Ef
701
- req .Search .Params .Radius = param .Params .Radius
706
+ }
707
+ if param .Radius != nil {
708
+ req .Search .Radius = param .Radius
702
709
}
703
710
}
704
711
0 commit comments