Add test cases of search expression (#23694)

Signed-off-by: nico <cheng.yuan@zilliz.com>
This commit is contained in:
nico 2023-05-06 21:16:39 +08:00 committed by GitHub
parent 7e28ac751b
commit ad75afdcd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 1 deletions

View File

@ -200,6 +200,7 @@ skip_pq = ["IVF_PQ"]
float_metrics = ["L2", "IP", "COSINE"]
binary_metrics = ["JACCARD", "HAMMING", "TANIMOTO", "SUBSTRUCTURE", "SUPERSTRUCTURE"]
structure_metrics = ["SUBSTRUCTURE", "SUPERSTRUCTURE"]
all_scalar_data_types = ['int8', 'int16', 'int32', 'int64', 'float', 'double', 'bool', 'varchar']
class CheckTasks:

View File

@ -216,7 +216,7 @@ class TestCompactionParams(TestcaseBase):
# Travel time currently does not support travel back to retention ago, so just verify search is available.
assert len(res[0]) == ct.default_limit
@pytest.mark.tags(CaseLabel.L1)
@pytest.mark.tags(CaseLabel.L2)
def test_compact_delete_ratio(self):
"""
target: test delete entities reaches ratio and auto-compact

View File

@ -2727,6 +2727,39 @@ class TestCollectionSearch(TestcaseBase):
assert (default_int64_field_name and default_float_field_name and default_bool_field_name) \
in res[0][0].entity._row_data
@pytest.mark.tags(CaseLabel.L1)
@pytest.mark.skip(reason="issue #23646")
@pytest.mark.parametrize("field", ct.all_scalar_data_types[:3])
def test_search_expression_different_data_type(self, field):
"""
target: test search expression using different supported data types
method: search using different supported data types
expected: search success
"""
# 1. initialize with data
num = int(field[3:])
offset = 2 ** (num - 1)
default_schema = cf.gen_collection_schema_all_datatype()
collection_w = self.init_collection_wrap(schema=default_schema)
collection_w = cf.insert_data(collection_w, is_all_data_type=True, insert_offset=offset-1000)[0]
# 2. create index and load
collection_w.create_index(field_name, default_index_params)
collection_w.load()
# 3. search
log.info("test_search_expression_different_data_type: Searching collection %s" % collection_w.name)
expression = f"{field} >= {offset}"
res = collection_w.search(vectors, default_search_field, default_search_params,
default_limit, expression, output_fields=[field],
check_task=CheckTasks.check_search_results,
check_items={"nq": default_nq,
"limit": default_limit})[0]
# 4. check the result
for ids in res[0].ids:
assert ids >= offset
@pytest.mark.tags(CaseLabel.L1)
def test_search_with_comparative_expression(self, _async):
"""