mirror of
https://github.com/qdrant/qdrant.git
synced 2026-07-31 15:11:35 -05:00
86 lines
2.3 KiB
Python
86 lines
2.3 KiB
Python
import pytest
|
|
|
|
from .helpers.collection_setup import drop_collection
|
|
from .helpers.helpers import request_with_validation
|
|
|
|
collection_name = 'test_sparse_vector_config_update'
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def setup():
|
|
sparse_collection_setup(collection_name=collection_name)
|
|
yield
|
|
drop_collection(collection_name=collection_name)
|
|
|
|
|
|
def sparse_collection_setup(collection_name='test_collection'):
|
|
response = request_with_validation(
|
|
api='/collections/{collection_name}',
|
|
method="DELETE",
|
|
path_params={'collection_name': collection_name},
|
|
)
|
|
assert response.ok
|
|
|
|
response = request_with_validation(
|
|
api='/collections/{collection_name}',
|
|
method="PUT",
|
|
path_params={'collection_name': collection_name},
|
|
body={
|
|
"sparse_vectors": {
|
|
"sparse-text": {
|
|
"index": {
|
|
"on_disk": False,
|
|
}
|
|
},
|
|
},
|
|
}
|
|
)
|
|
assert response.ok
|
|
|
|
response = request_with_validation(
|
|
api='/collections/{collection_name}',
|
|
method="GET",
|
|
path_params={'collection_name': collection_name},
|
|
)
|
|
assert response.ok
|
|
|
|
|
|
def test_sparse_vector_config_update():
|
|
response = request_with_validation(
|
|
api='/collections/{collection_name}',
|
|
method="GET",
|
|
path_params={'collection_name': collection_name},
|
|
)
|
|
|
|
assert response.ok
|
|
result = response.json()["result"]
|
|
config = result["config"]
|
|
assert not config["params"]["sparse_vectors"]["sparse-text"]["index"]["on_disk"]
|
|
|
|
response = request_with_validation(
|
|
api='/collections/{collection_name}',
|
|
method="PATCH",
|
|
path_params={'collection_name': collection_name},
|
|
body={
|
|
"sparse_vectors": {
|
|
"sparse-text": {
|
|
"index": {
|
|
"on_disk": True,
|
|
}
|
|
},
|
|
},
|
|
}
|
|
)
|
|
assert response.ok
|
|
|
|
response = request_with_validation(
|
|
api='/collections/{collection_name}',
|
|
method="GET",
|
|
path_params={'collection_name': collection_name},
|
|
)
|
|
|
|
assert response.ok
|
|
result = response.json()["result"]
|
|
config = result["config"]
|
|
assert config["params"]["sparse_vectors"]["sparse-text"]["index"]["on_disk"]
|