From a0a4ec8b67660f58e42ff8a99c38ec3d6ba15d62 Mon Sep 17 00:00:00 2001 From: Cai Yudong Date: Tue, 9 Apr 2024 16:17:26 +0800 Subject: [PATCH] enhance: make range search param check message more meaningful (#32006) Issue: #31970 Signed-off-by: Cai Yudong --- internal/core/src/common/RangeSearchHelper.cpp | 10 ++++++---- internal/proxy/task_search.go | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/core/src/common/RangeSearchHelper.cpp b/internal/core/src/common/RangeSearchHelper.cpp index b2d49597d4..05250ce42a 100644 --- a/internal/core/src/common/RangeSearchHelper.cpp +++ b/internal/core/src/common/RangeSearchHelper.cpp @@ -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); } diff --git a/internal/proxy/task_search.go b/internal/proxy/task_search.go index f6a1b66d6c..269cf84f9d 100644 --- a/internal/proxy/task_search.go +++ b/internal/proxy/task_search.go @@ -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) } }