Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: [skip e2e]Add tests for sparse ehance #39506

Open
wants to merge 3 commits into
base: 2.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/python_client/common/common_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,12 @@
"SPARSE_INVERTED_INDEX", "SPARSE_WAND",
"GPU_IVF_FLAT", "GPU_IVF_PQ"]

inverted_index_algo = ['TAAT_NAIVE', 'DAAT_WAND', 'DAAT_MAXSCORE']

default_all_indexes_params = [{}, {"nlist": 128}, {"nlist": 128}, {"nlist": 128, "m": 16, "nbits": 8},
{"M": 32, "efConstruction": 360}, {"nlist": 128}, {},
{}, {"nlist": 64},
{"drop_ratio_build": 0.2}, {"drop_ratio_build": 0.2},
{}, {"drop_ratio_build": 0.2},
{"nlist": 64}, {"nlist": 64, "m": 16, "nbits": 8}]

default_all_search_params_params = [{}, {"nprobe": 32}, {"nprobe": 32}, {"nprobe": 32},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def scalar_index(self, request):
"""

@pytest.mark.tags(CaseLabel.L1)
@pytest.mark.skip("https://github.com/milvus-io/pymilvus/issues/1886")
# @pytest.mark.skip("https://github.com/milvus-io/pymilvus/issues/1886")
@pytest.mark.parametrize("index, params",
zip(ct.all_index_types[:7],
ct.default_all_indexes_params[:7]))
Expand Down
14 changes: 9 additions & 5 deletions tests/python_client/testcases/test_full_text_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2312,12 +2312,13 @@ def test_full_text_search_default(
@pytest.mark.parametrize("enable_partition_key", [True])
@pytest.mark.parametrize("enable_inverted_index", [True])
@pytest.mark.parametrize("index_type", ["SPARSE_INVERTED_INDEX"])
@pytest.mark.parametrize("inverted_index_algo", ct.inverted_index_algo)
@pytest.mark.parametrize("expr", ["text_match"])
@pytest.mark.parametrize("offset", [10])
@pytest.mark.parametrize("tokenizer", ["jieba"])
def test_full_text_search_with_jieba_tokenizer(
self, offset, tokenizer, expr, enable_inverted_index, enable_partition_key, empty_percent, index_type, nq
):
self, offset, tokenizer, expr, enable_inverted_index, enable_partition_key, empty_percent,
index_type, inverted_index_algo, nq):
"""
target: test full text search
method: 1. enable full text search with jieba tokenizer and insert data with varchar
Expand Down Expand Up @@ -2430,6 +2431,7 @@ def test_full_text_search_with_jieba_tokenizer(
"params": {
"bm25_k1": 1.5,
"bm25_b": 0.75,
"inverted_index_algo": inverted_index_algo
}
}
)
Expand Down Expand Up @@ -3301,10 +3303,11 @@ class TestHybridSearchWithFullTextSearch(TestcaseBase):
@pytest.mark.parametrize("enable_partition_key", [True])
@pytest.mark.parametrize("enable_inverted_index", [True])
@pytest.mark.parametrize("index_type", ["SPARSE_INVERTED_INDEX"])
@pytest.mark.parametrize("inverted_index_algo", ct.inverted_index_algo)
@pytest.mark.parametrize("tokenizer", ["standard"])
def test_hybrid_search_with_full_text_search(
self, tokenizer, enable_inverted_index, enable_partition_key, empty_percent, index_type
):
def test_hybrid_search_with_full_text_search(self, tokenizer, enable_inverted_index,
enable_partition_key, empty_percent, index_type,
inverted_index_algo):
"""
target: test full text search
method: 1. enable full text search and insert data with varchar
Expand Down Expand Up @@ -3403,6 +3406,7 @@ def test_hybrid_search_with_full_text_search(
"params": {
"bm25_k1": 1.5,
"bm25_b": 0.75,
"inverted_index_algo": inverted_index_algo
}
}
)
Expand Down
22 changes: 22 additions & 0 deletions tests/python_client/testcases/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,28 @@ def test_invalid_sparse_ratio(self, ratio, index):
check_task=CheckTasks.err_res,
check_items=error)

@pytest.mark.tags(CaseLabel.L2)
@pytest.mark.parametrize("inverted_index_algo", ["INVALID_ALGO"])
@pytest.mark.parametrize("index ", ct.all_index_types[9:11])
def test_invalid_sparse_inverted_index_algo(self, inverted_index_algo, index):
"""
target: index creation for unsupported ratio parameter
method: indexing of unsupported ratio parameters
expected: raise exception
"""
c_name = cf.gen_unique_str(prefix)
schema = cf.gen_default_sparse_schema()
collection_w = self.init_collection_wrap(name=c_name, schema=schema)
data = cf.gen_default_list_sparse_data()
collection_w.insert(data=data)
params = {"index_type": index, "metric_type": "IP", "params": {"inverted_index_algo": inverted_index_algo}}
error = {ct.err_code: 999,
ct.err_msg: f"sparse inverted index algo {inverted_index_algo} not found or not supported, "
f"supported: [TAAT_NAIVE DAAT_WAND DAAT_MAXSCORE]"}
index, _ = self.index_wrap.init_index(collection_w.collection, ct.default_sparse_vec_field_name, params,
check_task=CheckTasks.err_res,
check_items=error)


@pytest.mark.tags(CaseLabel.GPU)
class TestNewIndexAsync(TestcaseBase):
Expand Down
Loading