enhance: make range search param check message more meaningful (#32006)

Issue: #31970

Signed-off-by: Cai Yudong <yudong.cai@zilliz.com>
This commit is contained in:
Cai Yudong 2024-04-09 16:17:26 +08:00 committed by GitHub
parent 177ddda47f
commit a0a4ec8b67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -120,14 +120,16 @@ CheckRangeSearchParam(float radius,
*/
if (PositivelyRelated(metric_type)) {
AssertInfo(range_filter > radius,
"range_filter({}) must be greater than radius({}) for "
"IP/COSINE",
"metric type ({}), range_filter({}) must be greater than "
"radius({})",
metric_type.c_str(),
range_filter,
radius);
} else {
AssertInfo(range_filter < radius,
"range_filter({}) must be less than radius({}) for "
"L2/HAMMING/JACCARD",
"metric type ({}), range_filter({}) must be less than "
"radius({})",
metric_type.c_str(),
range_filter,
radius);
}

View File

@ -981,12 +981,12 @@ func checkRangeSearchParams(str string, metricType string) error {
if metric.PositivelyRelated(metricType) {
if params.radius >= params.rangeFilter {
msg := fmt.Sprintf("range_filter must be greater than radius for IP/COSINE, range_filter:%f, radius:%f", params.rangeFilter, params.radius)
msg := fmt.Sprintf("metric type '%s', range_filter(%f) must be greater than radius(%f)", metricType, params.rangeFilter, params.radius)
return merr.WrapErrParameterInvalidMsg(msg)
}
} else {
if params.radius <= params.rangeFilter {
msg := fmt.Sprintf("range_filter must be less than radius for L2/HAMMING/JACCARD, range_filter:%f, radius:%f", params.rangeFilter, params.radius)
msg := fmt.Sprintf("metric type '%s', range_filter(%f) must be less than radius(%f)", metricType, params.rangeFilter, params.radius)
return merr.WrapErrParameterInvalidMsg(msg)
}
}