|
@@ 401-421 (lines=21) @@
|
| 398 |
|
status = connect.create_index(collection, index_type, index_param) |
| 399 |
|
assert status.OK() |
| 400 |
|
|
| 401 |
|
@pytest.mark.level(2) |
| 402 |
|
@pytest.mark.timeout(BUILD_TIMEOUT) |
| 403 |
|
def test_create_different_index_repeatedly(self, connect, collection): |
| 404 |
|
''' |
| 405 |
|
target: check if index can be created repeatedly, with the different create_index params |
| 406 |
|
method: create another index with different index_params after index have been built |
| 407 |
|
expected: return code 0, and describe index result equals with the second index params |
| 408 |
|
''' |
| 409 |
|
nlist = NLIST |
| 410 |
|
status, ids = connect.insert(collection, vectors) |
| 411 |
|
index_type_1 = IndexType.IVF_SQ8 |
| 412 |
|
index_type_2 = IndexType.IVFLAT |
| 413 |
|
indexs = [{"index_type": index_type_1, "index_param": {"nlist": nlist}}, {"index_type": index_type_2, "index_param": {"nlist": nlist}}] |
| 414 |
|
logging.getLogger().info(indexs) |
| 415 |
|
for index in indexs: |
| 416 |
|
status = connect.create_index(collection, index["index_type"], index["index_param"]) |
| 417 |
|
assert status.OK() |
| 418 |
|
status, result = connect.get_index_info(collection) |
| 419 |
|
assert result._params["nlist"] == nlist |
| 420 |
|
assert result._collection_name == collection |
| 421 |
|
assert result._index_type == index_type_2 |
| 422 |
|
|
| 423 |
|
""" |
| 424 |
|
****************************************************************** |
|
@@ 900-919 (lines=20) @@
|
| 897 |
|
assert len(result) == 1 |
| 898 |
|
assert len(result[0]) == top_k |
| 899 |
|
|
| 900 |
|
@pytest.mark.timeout(BUILD_TIMEOUT) |
| 901 |
|
def test_create_different_index_repeatedly(self, connect, ip_collection): |
| 902 |
|
''' |
| 903 |
|
target: check if index can be created repeatedly, with the different create_index params |
| 904 |
|
method: create another index with different index_params after index have been built |
| 905 |
|
expected: return code 0, and describe index result equals with the second index params |
| 906 |
|
''' |
| 907 |
|
nlist = NLIST |
| 908 |
|
status, ids = connect.insert(ip_collection, vectors) |
| 909 |
|
index_type_1 = IndexType.IVF_SQ8 |
| 910 |
|
index_type_2 = IndexType.IVFLAT |
| 911 |
|
indexs = [{"index_type": index_type_1, "index_param": {"nlist": nlist}}, {"index_type": index_type_2, "index_param": {"nlist": nlist}}] |
| 912 |
|
logging.getLogger().info(indexs) |
| 913 |
|
for index in indexs: |
| 914 |
|
status = connect.create_index(ip_collection, index["index_type"], index["index_param"]) |
| 915 |
|
assert status.OK() |
| 916 |
|
status, result = connect.get_index_info(ip_collection) |
| 917 |
|
assert result._params["nlist"] == nlist |
| 918 |
|
assert result._collection_name == ip_collection |
| 919 |
|
assert result._index_type == index_type_2 |
| 920 |
|
|
| 921 |
|
""" |
| 922 |
|
****************************************************************** |