Skip to content

Commit f4fe920

Browse files
authored
test: [cherry-pick]add multi analyzer test (#41632)
pr: #41578 /kind improvement Signed-off-by: zhuwenxing <[email protected]>
1 parent f6d2f01 commit f4fe920

File tree

4 files changed

+1678
-306
lines changed

4 files changed

+1678
-306
lines changed

tests/python_client/base/client_base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class TestcaseBase(Base):
138138
Additional methods;
139139
Public methods that can be used for test cases.
140140
"""
141+
client = None
141142

142143
def _connect(self, enable_milvus_client_api=False):
143144
""" Add a connection and create the connect """
@@ -152,6 +153,7 @@ def _connect(self, enable_milvus_client_api=False):
152153
self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING,uri=uri,token=cf.param_info.param_token)
153154
res, is_succ = self.connection_wrap.MilvusClient(uri=uri,
154155
token=cf.param_info.param_token)
156+
self.client = MilvusClient(uri=uri, token=cf.param_info.param_token)
155157
else:
156158
if cf.param_info.param_user and cf.param_info.param_password:
157159
res, is_succ = self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING,
@@ -165,6 +167,8 @@ def _connect(self, enable_milvus_client_api=False):
165167
host=cf.param_info.param_host,
166168
port=cf.param_info.param_port)
167169

170+
uri = "http://" + cf.param_info.param_host + ":" + str(cf.param_info.param_port)
171+
self.client = MilvusClient(uri=uri, token=cf.param_info.param_token)
168172
server_version = utility.get_server_version()
169173
log.info(f"server version: {server_version}")
170174
return res
@@ -183,7 +187,7 @@ def get_tokens_by_analyzer(self, text, analyzer_params):
183187
res = client.run_analyzer(text, analyzer_params, with_detail=True, with_hash=True)
184188
tokens = [r['token'] for r in res.tokens]
185189
return tokens
186-
190+
187191

188192
# def init_async_milvus_client(self):
189193
# uri = cf.param_info.param_uri or f"http://{cf.param_info.param_host}:{cf.param_info.param_port}"

tests/python_client/milvus_client/test_milvus_client_analyzer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ class TestMilvusClientAnalyzer(TestMilvusClientV2Base):
1818
},
1919
{
2020
"tokenizer": "jieba",
21+
"filter": [
22+
{
23+
"type": "stop",
24+
"stop_words": ["is", "the", "this", "a", "an", "and", "or", "是", "的", "这", "一个", "和", "或"],
25+
}
26+
],
2127
},
2228
{
2329
"tokenizer": "icu"

0 commit comments

Comments
 (0)