mirror of https://github.com/milvus-io/milvus.git
parent
e07e8df6e8
commit
e1cef261cd
|
@ -409,6 +409,31 @@ def gen_search_param(index_type, metric_type="L2"):
|
||||||
return search_params
|
return search_params
|
||||||
|
|
||||||
|
|
||||||
|
def gen_invalid_search_param(index_type, metric_type="L2"):
|
||||||
|
search_params = []
|
||||||
|
if index_type in ["FLAT", "IVF_FLAT", "IVF_SQ8", "IVF_SQ8H", "IVF_PQ"] \
|
||||||
|
or index_type in ["BIN_FLAT", "BIN_IVF_FLAT"]:
|
||||||
|
for nprobe in [-1]:
|
||||||
|
ivf_search_params = {"metric_type": metric_type, "params": {"nprobe": nprobe}}
|
||||||
|
search_params.append(ivf_search_params)
|
||||||
|
elif index_type in ["HNSW", "RHNSW_FLAT", "RHNSW_PQ", "RHNSW_SQ"]:
|
||||||
|
for ef in [-1]:
|
||||||
|
hnsw_search_param = {"metric_type": metric_type, "params": {"ef": ef}}
|
||||||
|
search_params.append(hnsw_search_param)
|
||||||
|
elif index_type in ["NSG", "RNSG"]:
|
||||||
|
for search_length in [100, 300]:
|
||||||
|
nsg_search_param = {"metric_type": metric_type, "params": {"search_length": search_length}}
|
||||||
|
search_params.append(nsg_search_param)
|
||||||
|
elif index_type == "ANNOY":
|
||||||
|
for search_k in ["-1"]:
|
||||||
|
annoy_search_param = {"metric_type": metric_type, "params": {"search_k": search_k}}
|
||||||
|
search_params.append(annoy_search_param)
|
||||||
|
else:
|
||||||
|
log.error("Invalid index_type.")
|
||||||
|
raise Exception("Invalid index_type.")
|
||||||
|
return search_params
|
||||||
|
|
||||||
|
|
||||||
def gen_all_type_fields():
|
def gen_all_type_fields():
|
||||||
fields = []
|
fields = []
|
||||||
for k, v in DataType.__members__.items():
|
for k, v in DataType.__members__.items():
|
||||||
|
|
|
@ -274,7 +274,8 @@ class TestCollectionSearchInvalid(TestcaseBase):
|
||||||
"err_msg": "Field %s doesn't exist in schema"
|
"err_msg": "Field %s doesn't exist in schema"
|
||||||
% invalid_search_field})
|
% invalid_search_field})
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L2)
|
@pytest.mark.tags(CaseLabel.L1)
|
||||||
|
@pytest.mark.xfail(reason="issue 17935")
|
||||||
def test_search_param_invalid_metric_type(self, get_invalid_metric_type):
|
def test_search_param_invalid_metric_type(self, get_invalid_metric_type):
|
||||||
"""
|
"""
|
||||||
target: test search with invalid parameter values
|
target: test search with invalid parameter values
|
||||||
|
@ -293,7 +294,7 @@ class TestCollectionSearchInvalid(TestcaseBase):
|
||||||
check_items={"err_code": 1,
|
check_items={"err_code": 1,
|
||||||
"err_msg": "metric type not found"})
|
"err_msg": "metric type not found"})
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L2)
|
@pytest.mark.tags(CaseLabel.L1)
|
||||||
@pytest.mark.parametrize("index, params",
|
@pytest.mark.parametrize("index, params",
|
||||||
zip(ct.all_index_types[:9],
|
zip(ct.all_index_types[:9],
|
||||||
ct.default_index_params[:9]))
|
ct.default_index_params[:9]))
|
||||||
|
@ -614,11 +615,10 @@ class TestCollectionSearchInvalid(TestcaseBase):
|
||||||
check_items={"err_code": 1,
|
check_items={"err_code": 1,
|
||||||
"err_msg": "PartitonName: %s not found" % deleted_par_name})
|
"err_msg": "PartitonName: %s not found" % deleted_par_name})
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L2)
|
@pytest.mark.tags(CaseLabel.L1)
|
||||||
@pytest.mark.xfail(reason="issue 6731")
|
|
||||||
@pytest.mark.parametrize("index, params",
|
@pytest.mark.parametrize("index, params",
|
||||||
zip(ct.all_index_types[:9],
|
zip(ct.all_index_types[1:9],
|
||||||
ct.default_index_params[:9]))
|
ct.default_index_params[1:9]))
|
||||||
def test_search_different_index_invalid_params(self, index, params):
|
def test_search_different_index_invalid_params(self, index, params):
|
||||||
"""
|
"""
|
||||||
target: test search with different index
|
target: test search with different index
|
||||||
|
@ -640,13 +640,13 @@ class TestCollectionSearchInvalid(TestcaseBase):
|
||||||
collection_w.load()
|
collection_w.load()
|
||||||
# 3. search
|
# 3. search
|
||||||
log.info("test_search_different_index_invalid_params: Searching after creating index-%s" % index)
|
log.info("test_search_different_index_invalid_params: Searching after creating index-%s" % index)
|
||||||
|
search_params = cf.gen_invalid_search_param(index)
|
||||||
collection_w.search(vectors, default_search_field,
|
collection_w.search(vectors, default_search_field,
|
||||||
default_search_params, default_limit,
|
search_params[0], default_limit,
|
||||||
default_search_exp,
|
default_search_exp,
|
||||||
check_task=CheckTasks.check_search_results,
|
check_task=CheckTasks.err_res,
|
||||||
check_items={"nq": default_nq,
|
check_items={"err_code": 1,
|
||||||
"ids": insert_ids,
|
"err_msg": "Search params check failed"})
|
||||||
"limit": default_limit})
|
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L2)
|
@pytest.mark.tags(CaseLabel.L2)
|
||||||
def test_search_index_partition_not_existed(self):
|
def test_search_index_partition_not_existed(self):
|
||||||
|
|
Loading…
Reference in New Issue