Skip to content

Commit d9c93d4

Browse files
committed
feat: Optionally delete points
Signed-off-by: Anush008 <[email protected]>
1 parent f749375 commit d9c93d4

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

examples/text_embedding_qdrant/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "text-embedding"
2+
name = "text-embedding-qdrant"
33
version = "0.1.0"
44
description = "Simple example for cocoindex: build embedding index based on local text files."
55
requires-python = ">=3.10"

src/ops/storages/qdrant.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use anyhow::{bail, Result};
1010
use futures::FutureExt;
1111
use qdrant_client::qdrant::vectors_output::VectorsOptions;
1212
use qdrant_client::qdrant::{
13-
NamedVectors, PointId, PointStruct, UpsertPointsBuilder, Value as QdrantValue,
13+
DeletePointsBuilder, NamedVectors, PointId, PointStruct, PointsIdsList, UpsertPointsBuilder,
14+
Value as QdrantValue,
1415
};
1516
use qdrant_client::qdrant::{Query, QueryPointsBuilder, ScoredPoint};
1617
use qdrant_client::Qdrant;
@@ -77,6 +78,23 @@ impl ExportTargetExecutor for Executor {
7778
self.client
7879
.upsert_points(UpsertPointsBuilder::new(&self.collection_name, points).wait(true))
7980
.await?;
81+
82+
let ids = mutation
83+
.delete_keys
84+
.iter()
85+
.map(key_to_point_id)
86+
.collect::<Result<Vec<_>>>()?;
87+
88+
if !ids.is_empty() {
89+
self.client
90+
.delete_points(
91+
DeletePointsBuilder::new(&self.collection_name)
92+
.points(PointsIdsList { ids })
93+
.wait(true),
94+
)
95+
.await?;
96+
}
97+
8098
Ok(())
8199
}
82100
}

0 commit comments

Comments
 (0)