From d1d5efa1a5bca50fc56b18d1f55e7137c6caa6de Mon Sep 17 00:00:00 2001 From: binbin <83755740+binbinlv@users.noreply.github.com> Date: Tue, 5 Jul 2022 15:28:20 +0800 Subject: [PATCH] Optimize test common function (#18061) Signed-off-by: Binbin Lv --- tests/python_client/common/common_func.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/python_client/common/common_func.py b/tests/python_client/common/common_func.py index 6f950fb147..12cc832f7e 100644 --- a/tests/python_client/common/common_func.py +++ b/tests/python_client/common/common_func.py @@ -386,11 +386,18 @@ def gen_invaild_search_params_type(): def gen_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"]: + if index_type in ["FLAT", "IVF_FLAT", "IVF_SQ8", "IVF_SQ8H", "IVF_PQ"]: for nprobe in [64, 128]: ivf_search_params = {"metric_type": metric_type, "params": {"nprobe": nprobe}} search_params.append(ivf_search_params) + elif index_type in ["BIN_FLAT", "BIN_IVF_FLAT"]: + if metric_type not in ct.binary_metrics: + log.error("Metric type error: binary index only supports distance type in (%s)" % ct.binary_metrics) + # default metric type for binary index + metric_type = "JACCARD" + for nprobe in [64, 128]: + binary_search_params = {"metric_type": metric_type, "params": {"nprobe": nprobe}} + search_params.append(binary_search_params) elif index_type in ["HNSW", "RHNSW_FLAT", "RHNSW_PQ", "RHNSW_SQ"]: for ef in [64, 32768]: hnsw_search_param = {"metric_type": metric_type, "params": {"ef": ef}}