Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
07029931
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 搜索 >>
未验证
提交
07029931
编写于
7月 04, 2022
作者:
X
xige-16
提交者:
GitHub
7月 04, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix query not empty after delete string (#17953)
Signed-off-by:
N
xige-16
<
xi.ge@zilliz.com
>
上级
39db2786
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
6 deletion
+21
-6
internal/core/src/index/StringIndexMarisa.cpp
internal/core/src/index/StringIndexMarisa.cpp
+14
-5
internal/core/unittest/test_string_index.cpp
internal/core/unittest/test_string_index.cpp
+7
-0
tests/python_client/testcases/test_delete.py
tests/python_client/testcases/test_delete.py
+0
-1
未找到文件。
internal/core/src/index/StringIndexMarisa.cpp
浏览文件 @
07029931
...
...
@@ -115,13 +115,18 @@ StringIndexMarisa::Load(const BinarySet& set) {
fill_offsets
();
}
bool
valid_str_id
(
size_t
str_id
)
{
return
str_id
>=
0
&&
str_id
!=
MARISA_INVALID_KEY_ID
;
}
const
TargetBitmapPtr
StringIndexMarisa
::
In
(
size_t
n
,
const
std
::
string
*
values
)
{
TargetBitmapPtr
bitset
=
std
::
make_unique
<
TargetBitmap
>
(
str_ids_
.
size
());
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
auto
str
=
values
[
i
];
auto
str_id
=
lookup
(
str
);
if
(
str_id
>=
0
)
{
if
(
valid_str_id
(
str_id
)
)
{
auto
offsets
=
str_ids_to_offsets_
[
str_id
];
for
(
auto
offset
:
offsets
)
{
bitset
->
set
(
offset
);
...
...
@@ -138,7 +143,7 @@ StringIndexMarisa::NotIn(size_t n, const std::string* values) {
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
auto
str
=
values
[
i
];
auto
str_id
=
lookup
(
str
);
if
(
str_id
>=
0
)
{
if
(
valid_str_id
(
str_id
)
)
{
auto
offsets
=
str_ids_to_offsets_
[
str_id
];
for
(
auto
offset
:
offsets
)
{
bitset
->
reset
(
offset
);
...
...
@@ -234,7 +239,7 @@ StringIndexMarisa::fill_str_ids(size_t n, const std::string* values) {
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
auto
str
=
values
[
i
];
auto
str_id
=
lookup
(
str
);
assert
(
str_id
>=
0
);
assert
(
valid_str_id
(
str_id
)
);
str_ids_
[
i
]
=
str_id
;
}
}
...
...
@@ -254,8 +259,12 @@ size_t
StringIndexMarisa
::
lookup
(
const
std
::
string
&
str
)
{
marisa
::
Agent
agent
;
agent
.
set_query
(
str
.
c_str
());
trie_
.
lookup
(
agent
);
return
agent
.
key
().
id
();
if
(
trie_
.
lookup
(
agent
))
{
return
agent
.
key
().
id
();
}
// not found the string in trie
return
MARISA_INVALID_KEY_ID
;
}
std
::
vector
<
size_t
>
...
...
internal/core/unittest/test_string_index.cpp
浏览文件 @
07029931
...
...
@@ -208,6 +208,7 @@ TEST_F(StringIndexMarisaTest, Codec) {
str_ds
=
GenDsFromPB
(
str_arr
);
index
->
BuildWithDataset
(
str_ds
);
std
::
vector
<
std
::
string
>
invalid_strings
=
{
std
::
to_string
(
nb
)};
auto
copy_index
=
milvus
::
scalar
::
CreateStringIndexMarisa
();
{
...
...
@@ -221,6 +222,12 @@ TEST_F(StringIndexMarisaTest, Codec) {
ASSERT_TRUE
(
bitset
->
any
());
}
{
auto
bitset
=
copy_index
->
In
(
1
,
invalid_strings
.
data
());
ASSERT_EQ
(
bitset
->
size
(),
nb
);
ASSERT_TRUE
(
bitset
->
none
());
}
{
auto
bitset
=
copy_index
->
NotIn
(
nb
,
strings
.
data
());
ASSERT_EQ
(
bitset
->
size
(),
nb
);
...
...
tests/python_client/testcases/test_delete.py
浏览文件 @
07029931
...
...
@@ -1098,7 +1098,6 @@ class TestDeleteString(TestcaseBase):
collection_w
.
query
(
default_string_expr
,
check_task
=
CheckTasks
.
check_query_empty
)
collection_w
.
delete
(
expr
=
default_string_expr
)
@
pytest
.
mark
.
xfail
(
reason
=
"https://github.com/milvus-io/milvus/issues/17924"
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_delete_all_index_with_string
(
self
):
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录