Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
d7dd7831
M
milvus
项目概览
milvus
/
milvus
9 个月 前同步成功
通知
260
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
d7dd7831
编写于
8月 21, 2023
作者:
B
binbin
提交者:
GitHub
8月 21, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update retrieve vector cases (#26376)
Signed-off-by:
N
binbin lv
<
binbin.lv@zilliz.com
>
上级
2fd52e7f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
12 deletion
+25
-12
tests/python_client/common/common_func.py
tests/python_client/common/common_func.py
+4
-2
tests/python_client/common/common_type.py
tests/python_client/common/common_type.py
+1
-0
tests/python_client/testcases/test_search.py
tests/python_client/testcases/test_search.py
+20
-10
未找到文件。
tests/python_client/common/common_func.py
浏览文件 @
d7dd7831
...
...
@@ -564,7 +564,7 @@ def gen_search_param(index_type, metric_type="L2"):
binary_search_params
=
{
"metric_type"
:
metric_type
,
"params"
:
{
"nprobe"
:
nprobe
}}
search_params
.
append
(
binary_search_params
)
elif
index_type
in
[
"HNSW"
]:
for
ef
in
[
64
,
32768
]:
for
ef
in
[
64
,
1500
,
32768
]:
hnsw_search_param
=
{
"metric_type"
:
metric_type
,
"params"
:
{
"ef"
:
ef
}}
search_params
.
append
(
hnsw_search_param
)
elif
index_type
==
"ANNOY"
:
...
...
@@ -572,12 +572,14 @@ def gen_search_param(index_type, metric_type="L2"):
annoy_search_param
=
{
"metric_type"
:
metric_type
,
"params"
:
{
"search_k"
:
search_k
}}
search_params
.
append
(
annoy_search_param
)
elif
index_type
==
"DISKANN"
:
for
search_list
in
[
20
,
30
]:
for
search_list
in
[
20
,
30
0
,
1500
]:
diskann_search_param
=
{
"metric_type"
:
metric_type
,
"params"
:
{
"search_list"
:
search_list
}}
search_params
.
append
(
diskann_search_param
)
else
:
log
.
error
(
"Invalid index_type."
)
raise
Exception
(
"Invalid index_type."
)
log
.
debug
(
search_params
)
return
search_params
...
...
tests/python_client/common/common_type.py
浏览文件 @
d7dd7831
...
...
@@ -11,6 +11,7 @@ default_nb_medium = 5000
default_top_k
=
10
default_nq
=
2
default_limit
=
10
max_limit
=
16384
default_search_params
=
{
"metric_type"
:
"L2"
,
"params"
:
{
"nprobe"
:
10
}}
default_search_ip_params
=
{
"metric_type"
:
"IP"
,
"params"
:
{
"nprobe"
:
10
}}
default_search_binary_params
=
{
"metric_type"
:
"JACCARD"
,
"params"
:
{
"nprobe"
:
10
}}
...
...
tests/python_client/testcases/test_search.py
浏览文件 @
d7dd7831
...
...
@@ -30,6 +30,7 @@ default_nb_medium = ct.default_nb_medium
default_nq
=
ct
.
default_nq
default_dim
=
ct
.
default_dim
default_limit
=
ct
.
default_limit
max_limit
=
ct
.
max_limit
default_search_exp
=
"int64 >= 0"
default_json_search_exp
=
"json_field[
\"
number
\"
] >= 0"
default_search_string_exp
=
"varchar >=
\"
0
\"
"
...
...
@@ -2911,7 +2912,8 @@ class TestCollectionSearch(TestcaseBase):
zip
(
ct
.
all_index_types
[:
6
],
ct
.
default_index_params
[:
6
]))
@
pytest
.
mark
.
parametrize
(
"metrics"
,
ct
.
float_metrics
)
def
test_search_output_field_vector_after_different_index_metrics
(
self
,
index
,
params
,
metrics
):
@
pytest
.
mark
.
parametrize
(
"limit"
,
[
20
,
1200
])
def
test_search_output_field_vector_after_different_index_metrics
(
self
,
index
,
params
,
metrics
,
limit
):
"""
target: test search with output vector field after different index
method: 1. create a collection and insert data
...
...
@@ -2929,15 +2931,23 @@ class TestCollectionSearch(TestcaseBase):
collection_w
.
load
()
# 3. search with output field vector
search_params
=
cf
.
gen_search_param
(
index
,
metrics
)[
0
]
collection_w
.
search
(
vectors
[:
1
],
default_search_field
,
search_params
,
default_limit
,
default_search_exp
,
output_fields
=
[
field_name
],
check_task
=
CheckTasks
.
check_search_results
,
check_items
=
{
"nq"
:
1
,
"limit"
:
default_limit
,
"original_entities"
:
_vectors
,
"output_fields"
:
[
field_name
]})
search_params
=
cf
.
gen_search_param
(
index
,
metrics
)
for
search_param
in
search_params
:
log
.
info
(
search_param
)
if
index
==
"HNSW"
:
limit
=
search_param
[
"params"
][
"ef"
]
if
limit
>
max_limit
:
limit
=
default_nb
if
index
==
"DISKANN"
:
limit
=
search_param
[
"params"
][
"search_list"
]
collection_w
.
search
(
vectors
[:
1
],
default_search_field
,
search_param
,
limit
,
default_search_exp
,
output_fields
=
[
field_name
],
check_task
=
CheckTasks
.
check_search_results
,
check_items
=
{
"nq"
:
1
,
"limit"
:
limit
,
"original_entities"
:
_vectors
,
"output_fields"
:
[
field_name
]})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
parametrize
(
"index"
,
[
"BIN_FLAT"
,
"BIN_IVF_FLAT"
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录