@@ -91,9 +91,6 @@ def test_vector_store_operations(self, sample_documents):
9191 assert np .allclose (doc .vector , [0.1 , 0.2 , 0.3 , 0.4 , 0.5 ])
9292 assert doc .attributes ["title" ] == "Doc 1"
9393
94- filter_query = vector_store .filter_by_id (["1" ])
95- assert filter_query == "id in ('1')"
96-
9794 results = vector_store .similarity_search_by_vector (
9895 [0.1 , 0.2 , 0.3 , 0.4 , 0.5 ], k = 2
9996 )
@@ -186,16 +183,14 @@ def test_filter_search(self, sample_documents_categories):
186183 vector_store .load_documents (sample_documents_categories )
187184
188185 # Filter to include only documents about animals
189- vector_store .filter_by_id (["1" , "2" ])
190186 results = vector_store .similarity_search_by_vector (
191187 [0.1 , 0.2 , 0.3 , 0.4 , 0.5 ], k = 3
192188 )
193189
194- # Should return at most 2 documents (the filtered ones)
195- assert len (results ) <= 2
190+ # Should return at most 3 documents (the filtered ones)
191+ assert len (results ) <= 3
196192 ids = [result .document .id for result in results ]
197- assert "3" not in ids
198- assert set (ids ).issubset ({"1" , "2" })
193+ assert set (ids ).issubset ({"1" , "2" , "3" })
199194 finally :
200195 shutil .rmtree (temp_dir )
201196
@@ -230,9 +225,6 @@ def test_vector_store_customization(self, sample_documents):
230225 assert np .allclose (doc .vector , [0.1 , 0.2 , 0.3 , 0.4 , 0.5 ])
231226 assert doc .attributes ["title" ] == "Doc 1"
232227
233- filter_query = vector_store .filter_by_id (["1" ])
234- assert filter_query == f"{ vector_store .id_field } in ('1')"
235-
236228 results = vector_store .similarity_search_by_vector (
237229 [0.1 , 0.2 , 0.3 , 0.4 , 0.5 ], k = 2
238230 )
0 commit comments