mirror of
https://github.com/typesense/typesense.git
synced 2025-05-21 22:33:27 +08:00
Ensure that vec distance is always positive for cosine.
This commit is contained in:
parent
d5968b85f7
commit
8895435591
@ -2572,8 +2572,11 @@ void Index::search(std::vector<query_tokens_t>& field_query_tokens, const std::v
|
||||
groups_processed.emplace(distinct_id);
|
||||
}
|
||||
|
||||
auto vec_dist_score = (field_vector_index->distance_type == cosine) ? std::abs(dist_label.first) :
|
||||
dist_label.first;
|
||||
|
||||
int64_t scores[3] = {0};
|
||||
scores[0] = -float_to_int64_t(dist_label.first);
|
||||
scores[0] = -float_to_int64_t(vec_dist_score);
|
||||
int64_t match_score_index = -1;
|
||||
|
||||
//LOG(INFO) << "SEQ_ID: " << seq_id << ", score: " << dist_label.first;
|
||||
|
Loading…
x
Reference in New Issue
Block a user