mirror of https://github.com/milvus-io/milvus.git
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>pull/30989/head
parent
41f1e6dcad
commit
8b25ecffff
|
@ -551,14 +551,30 @@ func rankSearchResultData(ctx context.Context,
|
||||||
continue
|
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
|
// sort id by score
|
||||||
var less func(i, j int) bool
|
var less func(i, j int) bool
|
||||||
if metric.PositivelyRelated(metricType) {
|
if metric.PositivelyRelated(metricType) {
|
||||||
less = func(i, j int) bool {
|
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]]
|
return idSet[keys[i]] > idSet[keys[j]]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
less = func(i, j int) bool {
|
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]]
|
return idSet[keys[i]] < idSet[keys[j]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11035,7 +11035,6 @@ class TestCollectionHybridSearchValid(TestcaseBase):
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L1)
|
@pytest.mark.tags(CaseLabel.L1)
|
||||||
@pytest.mark.parametrize("primary_field", [ct.default_int64_field_name, ct.default_string_field_name])
|
@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):
|
def test_hybrid_search_RRFRanker_default_parameter(self, primary_field):
|
||||||
"""
|
"""
|
||||||
target: test hybrid search with default value to RRFRanker
|
target: test hybrid search with default value to RRFRanker
|
||||||
|
|
Loading…
Reference in New Issue