From dfcdf690c2c4c75c29a5025e9fcb680697f30f4c Mon Sep 17 00:00:00 2001 From: capak07 <69026837+capak07@users.noreply.github.com> Date: Mon, 8 Apr 2024 00:28:42 -0300 Subject: [PATCH] Used batch job to delete --- lib/langchain/vectorsearch/weaviate.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/langchain/vectorsearch/weaviate.rb b/lib/langchain/vectorsearch/weaviate.rb index e2e60db85..32ae12e4c 100644 --- a/lib/langchain/vectorsearch/weaviate.rb +++ b/lib/langchain/vectorsearch/weaviate.rb @@ -71,13 +71,14 @@ def update_texts(texts:, ids:) end end + # Deletes a list of texts in the index + # @param ids The ids of texts to delete + # @return [Hash] The response from the server def remove_texts(ids:) - ids.map do |id| - client.objects.delete( - class_name: index_name, - id: id - ) - end + client.objects.batch_delete( + class_name: index_name, + where: "{ path: [\"__id\"], operator: ContainsAny, valueString: \"#{ids}\" }" + ) end # Create default schema