mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
fix: add pk sort for same distance of hybridsearch (#30901)
#29923 Signed-off-by: luzhang <luzhang@zilliz.com> Co-authored-by: luzhang <luzhang@zilliz.com>
This commit is contained in:
parent
41f1e6dcad
commit
8b25ecffff
@ -551,14 +551,30 @@ func rankSearchResultData(ctx context.Context,
|
||||
continue
|
||||
}
|
||||
|
||||
compareKeys := func(keyI, keyJ interface{}) bool {
|
||||
switch keyI.(type) {
|
||||
case int64:
|
||||
return keyI.(int64) < keyJ.(int64)
|
||||
case string:
|
||||
return keyI.(string) < keyJ.(string)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// sort id by score
|
||||
var less func(i, j int) bool
|
||||
if metric.PositivelyRelated(metricType) {
|
||||
less = func(i, j int) bool {
|
||||
if idSet[keys[i]] == idSet[keys[j]] {
|
||||
return compareKeys(keys[i], keys[j])
|
||||
}
|
||||
return idSet[keys[i]] > idSet[keys[j]]
|
||||
}
|
||||
} else {
|
||||
less = func(i, j int) bool {
|
||||
if idSet[keys[i]] == idSet[keys[j]] {
|
||||
return compareKeys(keys[i], keys[j])
|
||||
}
|
||||
return idSet[keys[i]] < idSet[keys[j]]
|
||||
}
|
||||
}
|
||||
|
@ -11035,7 +11035,6 @@ class TestCollectionHybridSearchValid(TestcaseBase):
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.parametrize("primary_field", [ct.default_int64_field_name, ct.default_string_field_name])
|
||||
@pytest.mark.xfail(reason="issue 29923")
|
||||
def test_hybrid_search_RRFRanker_default_parameter(self, primary_field):
|
||||
"""
|
||||
target: test hybrid search with default value to RRFRanker
|
||||
|
Loading…
Reference in New Issue
Block a user