Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
848db338
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
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 搜索 >>
未验证
提交
848db338
编写于
8月 30, 2021
作者:
Z
zhuwenxing
提交者:
GitHub
8月 30, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update search testcases (#7363)
Signed-off-by:
N
zhuwenxing
<
wenxing.zhu@zilliz.com
>
上级
bde83941
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
11 deletion
+9
-11
tests/python_client/testcases/collection/test_load_collection.py
...ython_client/testcases/collection/test_load_collection.py
+2
-2
tests/python_client/testcases/entity/test_search.py
tests/python_client/testcases/entity/test_search.py
+1
-1
tests/python_client/testcases/test_search_20.py
tests/python_client/testcases/test_search_20.py
+6
-8
未找到文件。
tests/python_client/testcases/collection/test_load_collection.py
浏览文件 @
848db338
...
...
@@ -311,8 +311,8 @@ class TestReleaseAdvanced:
connect
.
load_partitions
(
collection
,
[
default_tag
])
res
=
connect
.
search
(
collection
,
query
,
_async
=
True
)
connect
.
release_partitions
(
collection
,
[
default_tag
])
res
=
connect
.
search
(
collection
,
default_single_query
)
assert
len
(
res
[
0
])
==
0
with
pytest
.
raises
(
Exception
)
as
e
:
res
=
connect
.
search
(
collection
,
default_single_query
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
tags_smoke
)
def
test_release_collection_during_searching_A
(
self
,
connect
,
collection
):
...
...
tests/python_client/testcases/entity/test_search.py
浏览文件 @
848db338
...
...
@@ -1223,7 +1223,7 @@ class TestSearchDSL(object):
collection_term
=
gen_unique_str
(
"term"
)
connect
.
create_collection
(
collection_term
,
term_fields
)
term_entities
=
add_field
(
entities
,
field_name
=
"term"
)
ids
=
connect
.
insert
(
collection_term
,
term_entities
)
ids
=
connect
.
insert
(
collection_term
,
term_entities
)
.
primary_keys
assert
len
(
ids
)
==
default_nb
connect
.
flush
([
collection_term
])
# count = connect.count_entities(collection_term)
...
...
tests/python_client/testcases/test_search_20.py
浏览文件 @
848db338
...
...
@@ -1512,7 +1512,6 @@ class TestCollectionSearch(TestcaseBase):
assert
abs
(
res
[
0
].
_distances
[
0
]
-
min
(
distance_0
,
distance_1
))
<=
epsilon
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
xfail
(
expression
=
"500 <= int64 < 1000"
,
reason
=
"issue:7142"
)
@
pytest
.
mark
.
parametrize
(
"expression"
,
cf
.
gen_normal_expressions
())
def
test_search_with_expression
(
self
,
dim
,
expression
,
_async
):
"""
...
...
@@ -1526,10 +1525,10 @@ class TestCollectionSearch(TestcaseBase):
nb
,
dim
=
dim
,
is_index
=
True
)
# filter result with expression in coll
l
ection
# filter result with expression in collection
_vectors
=
_vectors
[
0
]
expression
=
expression
.
replace
(
"&&"
,
"and"
).
replace
(
"||"
,
"or"
)
filter_ids
=
[]
expression
=
expression
.
replace
(
"&&"
,
"and"
).
replace
(
"||"
,
"or"
)
filter_ids
=
[]
for
i
,
_id
in
enumerate
(
insert_ids
):
int64
=
_vectors
.
int64
[
i
]
float
=
_vectors
.
float
[
i
]
...
...
@@ -1559,10 +1558,9 @@ class TestCollectionSearch(TestcaseBase):
filter_ids_set
=
set
(
filter_ids
)
for
hits
in
search_res
:
ids
=
hits
.
ids
assert
set
(
ids
).
issubset
(
filter_ids_set
)
assert
set
(
ids
).
issubset
(
filter_ids_set
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
xfail
(
expression
=
f
"500 <=
{
default_float_field_name
}
<= 1000"
,
reason
=
"issue:7142"
)
@
pytest
.
mark
.
parametrize
(
"expression"
,
cf
.
gen_normal_expressions_field
(
default_float_field_name
))
def
test_search_with_expression_auto_id
(
self
,
dim
,
expression
,
_async
):
"""
...
...
@@ -1578,14 +1576,14 @@ class TestCollectionSearch(TestcaseBase):
is_index
=
True
)
# filter result with expression in coll
l
ection
# filter result with expression in collection
_vectors
=
_vectors
[
0
]
expression
=
expression
.
replace
(
"&&"
,
"and"
).
replace
(
"||"
,
"or"
)
filter_ids
=
[]
for
i
,
_id
in
enumerate
(
insert_ids
):
exec
(
f
"
{
default_float_field_name
}
= _vectors.
{
default_float_field_name
}
[i]"
)
if
not
expression
or
eval
(
expression
):
filter_ids
.
append
(
_id
)
filter_ids
.
append
(
_id
)
# 2. create index
index_param
=
{
"index_type"
:
"IVF_FLAT"
,
"metric_type"
:
"L2"
,
"params"
:
{
"nlist"
:
100
}}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录