mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 03:18:29 +08:00
Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
This commit is contained in:
parent
af8ea0f3af
commit
854c0e8a16
@ -44,7 +44,10 @@ struct SearchResultPair {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
operator>(const SearchResultPair& other) const {
|
operator>(const SearchResultPair& other) const {
|
||||||
if (std::fabs(distance_ - other.distance_) < 0.000001f) {
|
//according to FLT_EPSILON in cfloat, 0.000000119 is the maximum flaw for float32
|
||||||
|
//we use this to differentiate distances that are too close to each other to maintain the
|
||||||
|
//stable order for reduce
|
||||||
|
if (std::fabs(distance_ - other.distance_) < 0.000000119) {
|
||||||
return primary_key_ < other.primary_key_;
|
return primary_key_ < other.primary_key_;
|
||||||
}
|
}
|
||||||
return distance_ > other.distance_;
|
return distance_ > other.distance_;
|
||||||
|
Loading…
Reference in New Issue
Block a user