Skip to content

Commit

Permalink
Used batch job to delete
Browse files Browse the repository at this point in the history
  • Loading branch information
capak07 committed Apr 8, 2024
1 parent ba95ce3 commit dfcdf69
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/langchain/vectorsearch/weaviate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dfcdf69

Please sign in to comment.