Revert #11901, Fix wrong jaccard distance (#12487)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
This commit is contained in:
dragondriver 2021-11-30 20:31:35 +08:00 committed by GitHub
parent 37e6398ed6
commit 6d92b8499c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -68,8 +68,8 @@ Search(CSegmentInterface c_segment,
auto plan = (milvus::query::Plan*)c_plan;
auto phg_ptr = reinterpret_cast<const milvus::query::PlaceholderGroup*>(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;
}

View File

@ -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
}