From 6d92b8499c5568b9756174ac5853fcef2ee55035 Mon Sep 17 00:00:00 2001 From: dragondriver Date: Tue, 30 Nov 2021 20:31:35 +0800 Subject: [PATCH] Revert #11901, Fix wrong jaccard distance (#12487) Signed-off-by: dragondriver --- internal/core/src/segcore/segment_c.cpp | 4 ++-- internal/proxy/task.go | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/core/src/segcore/segment_c.cpp b/internal/core/src/segcore/segment_c.cpp index 4ac74c9c3e..c4196f1cec 100644 --- a/internal/core/src/segcore/segment_c.cpp +++ b/internal/core/src/segcore/segment_c.cpp @@ -68,8 +68,8 @@ Search(CSegmentInterface c_segment, auto plan = (milvus::query::Plan*)c_plan; auto phg_ptr = reinterpret_cast(c_placeholder_group); *search_result = segment->Search(plan, *phg_ptr, timestamp); - // if (plan->plan_node_->search_info_.metric_type_ != milvus::MetricType::METRIC_INNER_PRODUCT) { - if (!milvus::segcore::PositivelyRelated(plan->plan_node_->search_info_.metric_type_)) { + if (plan->plan_node_->search_info_.metric_type_ != milvus::MetricType::METRIC_INNER_PRODUCT) { + // if (!milvus::segcore::PositivelyRelated(plan->plan_node_->search_info_.metric_type_)) { for (auto& dis : search_result->distances_) { dis *= -1; } diff --git a/internal/proxy/task.go b/internal/proxy/task.go index aea141a7b2..b91c679f1e 100644 --- a/internal/proxy/task.go +++ b/internal/proxy/task.go @@ -30,8 +30,6 @@ import ( "strings" "unsafe" - "github.com/milvus-io/milvus/internal/util/distance" - "go.uber.org/zap" "github.com/golang/protobuf/proto" @@ -1833,8 +1831,8 @@ func reduceSearchResultData(searchResultData []*schemapb.SearchResultData, nq in log.Debug("skip duplicated search result", zap.Int64("count", skipDupCnt)) ret.Results.TopK = realTopK - // if metricType != "IP" { - if !distance.PositivelyRelated(metricType) { + if metricType != "IP" { + // if !distance.PositivelyRelated(metricType) { for k := range ret.Results.Scores { ret.Results.Scores[k] *= -1 }