Skip to content

Commit 71a66c2

Browse files
committed
fix and test
1 parent 64042e1 commit 71a66c2

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

tests/qdrant_syncronizer/test_qdrant_handler.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,28 @@ def test_should_handle_multiple_slices_for_same_collection_with_multi_lingual_co
134134
"collection_welearn_mul_mulembmodel": {doc_id1},
135135
}
136136
self.assertDictEqual(dict(collections_names), expected)
137+
138+
def test_should_handle_multiple_slices_for_same_collection_with_multi_lingual_collection_and_gibberish(
139+
self,
140+
):
141+
self.client.create_collection(
142+
collection_name="collection_welearn_mul_mulembmodel_og",
143+
vectors_config=models.VectorParams(
144+
size=50, distance=models.Distance.COSINE
145+
),
146+
)
147+
148+
doc_id0 = uuid.uuid4()
149+
doc_id1 = uuid.uuid4()
150+
qdrant_connector = self.client
151+
fake_slice0 = FakeSlice(doc_id0, embedding_model_name="english-embmodel")
152+
fake_slice1 = FakeSlice(doc_id0, embedding_model_name="english-embmodel")
153+
154+
fake_slice1.order_sequence = 1
155+
156+
fake_slice2 = FakeSlice(doc_id1, embedding_model_name="mulembmodel")
157+
fake_slice2.document.lang = "pt"
158+
159+
slices = [fake_slice0, fake_slice1, fake_slice2]
160+
collections_names = classify_documents_per_collection(qdrant_connector, slices)
161+
self.assertNotIn("collection_welearn_mul_mulembmodel_og", collections_names)

welearn_datastack/modules/qdrant_handler.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
from qdrant_client.http.models import models
1010

1111
from welearn_datastack.data.db_models import DocumentSlice
12-
from welearn_datastack.exceptions import (
13-
ErrorWhileDeletingChunks,
14-
)
12+
from welearn_datastack.exceptions import ErrorWhileDeletingChunks
1513

1614
logger = logging.getLogger(__name__)
1715

@@ -79,7 +77,6 @@ def delete_points_related_to_document(
7977
"""
8078
logger.info("Deletion started")
8179
logger.debug(f"Deleting points related to {documents_ids} in {collection_name}")
82-
op_res = None
8380

8481
try:
8582
op_res = qdrant_connector.delete(

0 commit comments

Comments
 (0)