Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
440ec8ac
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
261
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,发现更多精彩内容 >>
提交
440ec8ac
编写于
3月 24, 2021
作者:
T
ThreadDao
提交者:
yefu.chen
3月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix case for invalid search
Signed-off-by:
N
ThreadDao
<
yufen.zong@zilliz.com
>
上级
a3c09a19
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
3 deletion
+23
-3
tests/python_test/entity/test_search.py
tests/python_test/entity/test_search.py
+23
-3
未找到文件。
tests/python_test/entity/test_search.py
浏览文件 @
440ec8ac
...
...
@@ -1773,8 +1773,9 @@ class TestSearchInvalid(object):
def
get_search_params
(
self
,
request
):
yield
request
.
param
# #1463
@
pytest
.
mark
.
level
(
2
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
tags_0331
)
@
pytest
.
mark
.
tags
(
"fail"
)
def
test_search_with_invalid_params
(
self
,
connect
,
collection
,
get_simple_index
,
get_search_params
):
'''
target: test search function, with the wrong nprobe
...
...
@@ -1789,8 +1790,9 @@ class TestSearchInvalid(object):
if
index_type
!=
search_params
[
"index_type"
]:
# pytest.skip("skip if index_type not matched")
pass
entities
,
ids
=
init_data
(
connect
,
collection
)
entities
,
ids
=
init_data
(
connect
,
collection
,
nb
=
1200
)
connect
.
create_index
(
collection
,
field_name
,
get_simple_index
)
connect
.
load_collection
(
collection
)
query
,
vecs
=
gen_query_vectors
(
field_name
,
entities
,
default_top_k
,
1
,
search_params
=
search_params
[
"search_params"
])
with
pytest
.
raises
(
Exception
)
as
e
:
...
...
@@ -1810,13 +1812,15 @@ class TestSearchInvalid(object):
query_int_vectors
,
query_entities
,
tmp_ids
=
init_binary_data
(
connect
,
binary_collection
,
nb
=
1
,
insert
=
False
)
connect
.
create_index
(
binary_collection
,
binary_field_name
,
{
"index_type"
:
index_type
,
"metric_type"
:
"JACCARD"
,
"params"
:
{
"nlist"
:
128
}})
connect
.
load_collection
(
binary_collection
)
query
,
vecs
=
gen_query_vectors
(
binary_field_name
,
query_entities
,
default_top_k
,
nq
,
search_params
=
{
"nprobe"
:
0
},
metric_type
=
"JACCARD"
)
with
pytest
.
raises
(
Exception
)
as
e
:
res
=
connect
.
search
(
binary_collection
,
query
)
# #1464
@
pytest
.
mark
.
level
(
2
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
tags_0331
)
@
pytest
.
mark
.
tags
(
"fail"
)
def
test_search_with_empty_params
(
self
,
connect
,
collection
,
args
,
get_simple_index
):
'''
target: test search function, with empty search params
...
...
@@ -1831,10 +1835,26 @@ class TestSearchInvalid(object):
pass
entities
,
ids
=
init_data
(
connect
,
collection
)
connect
.
create_index
(
collection
,
field_name
,
get_simple_index
)
connect
.
load_collection
(
collection
)
query
,
vecs
=
gen_query_vectors
(
field_name
,
entities
,
default_top_k
,
1
,
search_params
=
{})
with
pytest
.
raises
(
Exception
)
as
e
:
res
=
connect
.
search
(
collection
,
query
)
# #1439
@
pytest
.
mark
.
tags
(
"fail"
)
def
test_search_with_empty_vectors
(
self
,
connect
,
collection
):
"""
target: test search function, with empty search vectors
method: search
expected: raise an exception
"""
entities
,
ids
=
init_data
(
connect
,
collection
)
assert
len
(
ids
)
==
default_nb
connect
.
load_collection
(
collection
)
query
,
vecs
=
gen_query_vectors
(
field_name
,
entities
,
default_top_k
,
nq
=
0
)
with
pytest
.
raises
(
Exception
)
as
e
:
res
=
connect
.
search
(
collection
,
query
)
def
check_id_result
(
result
,
id
):
limit_in
=
5
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录