@@ -150,3 +150,54 @@ def test_local_sparse_persistence(add_dense_to_config):
150150 client = qdrant_client .QdrantClient (path = tmpdir )
151151 assert client .count (default_collection_name ).count == 10
152152 assert client .count ("example_2" ).count == 10
153+
154+
155+ def test_update_persisence ():
156+ collection_name = "update_persisence"
157+ with tempfile .TemporaryDirectory () as tmpdir :
158+ client = qdrant_client .QdrantClient (path = tmpdir )
159+
160+ if client .collection_exists (collection_name ):
161+ client .delete_collection (collection_name )
162+
163+ client .create_collection (
164+ collection_name ,
165+ vectors_config = {"dense" : rest .VectorParams (size = 20 , distance = rest .Distance .COSINE )},
166+ sparse_vectors_config = {
167+ "text" : rest .SparseVectorParams (),
168+ },
169+ metadata = {"important" : "meta information" },
170+ )
171+
172+ original_collection_info = client .get_collection (collection_name )
173+
174+ assert original_collection_info .config .params .sparse_vectors ["text" ].modifier is None
175+ assert original_collection_info .config .metadata == {"important" : "meta information" }
176+
177+ client .update_collection (
178+ collection_name ,
179+ sparse_vectors_config = {"text" : rest .SparseVectorParams (modifier = rest .Modifier .IDF )},
180+ metadata = {"not_important" : "missing" },
181+ )
182+ updated_collection_info = client .get_collection (collection_name )
183+ assert (
184+ updated_collection_info .config .params .sparse_vectors ["text" ].modifier
185+ == rest .Modifier .IDF
186+ )
187+ assert updated_collection_info .config .metadata == {
188+ "important" : "meta information" ,
189+ "not_important" : "missing" ,
190+ }
191+ client .close ()
192+ del client
193+
194+ client = qdrant_client .QdrantClient (path = tmpdir )
195+ persisted_collection_info = client .get_collection (collection_name )
196+ assert (
197+ persisted_collection_info .config .params .sparse_vectors ["text" ].modifier
198+ == rest .Modifier .IDF
199+ )
200+ assert persisted_collection_info .config .metadata == {
201+ "important" : "meta information" ,
202+ "not_important" : "missing" ,
203+ }
0 commit comments