mirror of https://github.com/milvus-io/milvus.git
test: modify the order function in test cases (#31680)
issue: #30694 Signed-off-by: binbin lv <binbin.lv@zilliz.com>pull/31702/head
parent
b99c46246c
commit
6c6764bcad
|
@ -11886,9 +11886,9 @@ class TestCollectionHybridSearchValid(TestcaseBase):
|
|||
req = AnnSearchRequest(**search_param)
|
||||
req_list.append(req)
|
||||
# 4. hybrid search
|
||||
res = collection_w.hybrid_search(req_list, WeightedRanker(*weights), 10)
|
||||
is_sorted_decrease = lambda lst: all(lst[i]['distance'] >= lst[i+1]['distance'] for i in range(len(lst)-1))
|
||||
assert is_sorted_decrease(res[0])
|
||||
res = collection_w.hybrid_search(req_list, WeightedRanker(*weights), 10)[0]
|
||||
is_sorted_ascend = lambda lst: all(lst[i] <= lst[i+1] for i in range(len(lst)-1))
|
||||
assert is_sorted_ascend(res[0].distances)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
def test_hybrid_search_result_order(self):
|
||||
|
@ -11917,6 +11917,6 @@ class TestCollectionHybridSearchValid(TestcaseBase):
|
|||
req = AnnSearchRequest(**search_param)
|
||||
req_list.append(req)
|
||||
# 4. hybrid search
|
||||
res = collection_w.hybrid_search(req_list, WeightedRanker(*weights), 10)
|
||||
is_sorted_ascend = lambda lst: all(lst[i]['distance'] <= lst[i+1]['distance'] for i in range(len(lst)-1))
|
||||
assert is_sorted_ascend(res[0])
|
||||
res = collection_w.hybrid_search(req_list, WeightedRanker(*weights), 10)[0]
|
||||
is_sorted_descend = lambda lst: all(lst[i] >= lst[i+1] for i in range(len(lst)-1))
|
||||
assert is_sorted_descend(res[0].distances)
|
||||
|
|
Loading…
Reference in New Issue