Disambiguate document ids in with_lookup example

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dylan Couzon
2026-05-20 11:35:38 -04:00
co-authored by Claude Opus 4.7
parent 13690c49ac
commit 0ead6b8f8b
14 changed files with 60 additions and 59 deletions
@@ -13,7 +13,7 @@ public class Snippet
{
new()
{
Id = 1,
Id = 200,
Vectors = new Dictionary<string, Vector>(),
Payload =
{
@@ -23,7 +23,7 @@ public class Snippet
},
new()
{
Id = 2,
Id = 201,
Vectors = new Dictionary<string, Vector>(),
Payload =
{
@@ -42,13 +42,13 @@ public class Snippet
{
Id = 0,
Vectors = new float[] { 0.1f, 0.2f, 0.3f, 0.4f },
Payload = { ["document_id"] = 1 },
Payload = { ["document_id"] = 200 },
},
new()
{
Id = 1,
Vectors = new float[] { 0.5f, 0.6f, 0.7f, 0.8f },
Payload = { ["document_id"] = 2 },
Payload = { ["document_id"] = 201 },
},
}
);
@@ -10,7 +10,7 @@ await client.UpsertAsync(
{
new()
{
Id = 1,
Id = 200,
Vectors = new Dictionary<string, Vector>(),
Payload =
{
@@ -20,7 +20,7 @@ await client.UpsertAsync(
},
new()
{
Id = 2,
Id = 201,
Vectors = new Dictionary<string, Vector>(),
Payload =
{
@@ -39,13 +39,13 @@ await client.UpsertAsync(
{
Id = 0,
Vectors = new float[] { 0.1f, 0.2f, 0.3f, 0.4f },
Payload = { ["document_id"] = 1 },
Payload = { ["document_id"] = 200 },
},
new()
{
Id = 1,
Vectors = new float[] { 0.5f, 0.6f, 0.7f, 0.8f },
Payload = { ["document_id"] = 2 },
Payload = { ["document_id"] = 201 },
},
}
);
@@ -14,7 +14,7 @@ client.Upsert(context.Background(), &qdrant.UpsertPoints{
CollectionName: "documents",
Points: []*qdrant.PointStruct{
{
Id: qdrant.NewIDNum(1),
Id: qdrant.NewIDNum(200),
Vectors: qdrant.NewVectorsMap(map[string]*qdrant.Vector{}),
Payload: qdrant.NewValueMap(map[string]any{
"title": "Document A",
@@ -22,7 +22,7 @@ client.Upsert(context.Background(), &qdrant.UpsertPoints{
}),
},
{
Id: qdrant.NewIDNum(2),
Id: qdrant.NewIDNum(201),
Vectors: qdrant.NewVectorsMap(map[string]*qdrant.Vector{}),
Payload: qdrant.NewValueMap(map[string]any{
"title": "Document B",
@@ -38,12 +38,12 @@ client.Upsert(context.Background(), &qdrant.UpsertPoints{
{
Id: qdrant.NewIDNum(0),
Vectors: qdrant.NewVectors(0.1, 0.2, 0.3, 0.4),
Payload: qdrant.NewValueMap(map[string]any{"document_id": 1}),
Payload: qdrant.NewValueMap(map[string]any{"document_id": 200}),
},
{
Id: qdrant.NewIDNum(1),
Vectors: qdrant.NewVectors(0.5, 0.6, 0.7, 0.8),
Payload: qdrant.NewValueMap(map[string]any{"document_id": 2}),
Payload: qdrant.NewValueMap(map[string]any{"document_id": 201}),
},
},
})
@@ -17,14 +17,14 @@ client.upsertAsync(
"documents",
List.of(
PointStruct.newBuilder()
.setId(id(1))
.setId(id(200))
.setVectors(namedVectors(Map.of()))
.putAllPayload(Map.of(
"title", value("Document A"),
"text", value("This is document A")))
.build(),
PointStruct.newBuilder()
.setId(id(2))
.setId(id(201))
.setVectors(namedVectors(Map.of()))
.putAllPayload(Map.of(
"title", value("Document B"),
@@ -37,11 +37,11 @@ client.upsertAsync(
PointStruct.newBuilder()
.setId(id(0))
.setVectors(vectors(0.1f, 0.2f, 0.3f, 0.4f))
.putAllPayload(Map.of("document_id", value(1)))
.putAllPayload(Map.of("document_id", value(200)))
.build(),
PointStruct.newBuilder()
.setId(id(1))
.setVectors(vectors(0.5f, 0.6f, 0.7f, 0.8f))
.putAllPayload(Map.of("document_id", value(2)))
.putAllPayload(Map.of("document_id", value(201)))
.build())).get();
```
@@ -3,12 +3,12 @@ client.upsert(
collection_name="documents",
points=[
models.PointStruct(
id=1,
id=200,
vector={},
payload={"title": "Document A", "text": "This is document A"},
),
models.PointStruct(
id=2,
id=201,
vector={},
payload={"title": "Document B", "text": "This is document B"},
),
@@ -21,12 +21,12 @@ client.upsert(
models.PointStruct(
id=0,
vector=[0.1, 0.2, 0.3, 0.4],
payload={"document_id": 1},
payload={"document_id": 200},
),
models.PointStruct(
id=1,
vector=[0.5, 0.6, 0.7, 0.8],
payload={"document_id": 2},
payload={"document_id": 201},
),
],
)
@@ -9,7 +9,7 @@ client
"documents",
vec![
PointStruct::new(
1,
200,
HashMap::<String, Vector>::new(),
[
("title", "Document A".into()),
@@ -17,7 +17,7 @@ client
],
),
PointStruct::new(
2,
201,
HashMap::<String, Vector>::new(),
[
("title", "Document B".into()),
@@ -32,8 +32,8 @@ client
.upsert_points(UpsertPointsBuilder::new(
"chunks",
vec![
PointStruct::new(0, vec![0.1, 0.2, 0.3, 0.4], [("document_id", 1.into())]),
PointStruct::new(1, vec![0.5, 0.6, 0.7, 0.8], [("document_id", 2.into())]),
PointStruct::new(0, vec![0.1, 0.2, 0.3, 0.4], [("document_id", 200.into())]),
PointStruct::new(1, vec![0.5, 0.6, 0.7, 0.8], [("document_id", 201.into())]),
],
))
.await?;
@@ -2,12 +2,12 @@
await client.upsert("documents", {
points: [
{
id: 1,
id: 200,
vector: {},
payload: { title: "Document A", text: "This is document A" },
},
{
id: 2,
id: 201,
vector: {},
payload: { title: "Document B", text: "This is document B" },
},
@@ -19,12 +19,12 @@ await client.upsert("chunks", {
{
id: 0,
vector: [0.1, 0.2, 0.3, 0.4],
payload: { document_id: 1 },
payload: { document_id: 200 },
},
{
id: 1,
vector: [0.5, 0.6, 0.7, 0.8],
payload: { document_id: 2 },
payload: { document_id: 201 },
},
],
});
@@ -18,7 +18,7 @@ func Main() {
CollectionName: "documents",
Points: []*qdrant.PointStruct{
{
Id: qdrant.NewIDNum(1),
Id: qdrant.NewIDNum(200),
Vectors: qdrant.NewVectorsMap(map[string]*qdrant.Vector{}),
Payload: qdrant.NewValueMap(map[string]any{
"title": "Document A",
@@ -26,7 +26,7 @@ func Main() {
}),
},
{
Id: qdrant.NewIDNum(2),
Id: qdrant.NewIDNum(201),
Vectors: qdrant.NewVectorsMap(map[string]*qdrant.Vector{}),
Payload: qdrant.NewValueMap(map[string]any{
"title": "Document B",
@@ -42,12 +42,12 @@ func Main() {
{
Id: qdrant.NewIDNum(0),
Vectors: qdrant.NewVectors(0.1, 0.2, 0.3, 0.4),
Payload: qdrant.NewValueMap(map[string]any{"document_id": 1}),
Payload: qdrant.NewValueMap(map[string]any{"document_id": 200}),
},
{
Id: qdrant.NewIDNum(1),
Vectors: qdrant.NewVectors(0.5, 0.6, 0.7, 0.8),
Payload: qdrant.NewValueMap(map[string]any{"document_id": 2}),
Payload: qdrant.NewValueMap(map[string]any{"document_id": 201}),
},
},
})
@@ -3,12 +3,12 @@ PUT /collections/documents/points
{
"points": [
{
"id": 1,
"id": 200,
"vector": {},
"payload": {"title": "Document A", "text": "This is document A"}
},
{
"id": 2,
"id": 201,
"vector": {},
"payload": {"title": "Document B", "text": "This is document B"}
}
@@ -21,12 +21,12 @@ PUT /collections/chunks/points
{
"id": 0,
"vector": [0.1, 0.2, 0.3, 0.4],
"payload": {"document_id": 1}
"payload": {"document_id": 200}
},
{
"id": 1,
"vector": [0.5, 0.6, 0.7, 0.8],
"payload": {"document_id": 2}
"payload": {"document_id": 201}
}
]
}
@@ -20,14 +20,14 @@ public class Snippet {
"documents",
List.of(
PointStruct.newBuilder()
.setId(id(1))
.setId(id(200))
.setVectors(namedVectors(Map.of()))
.putAllPayload(Map.of(
"title", value("Document A"),
"text", value("This is document A")))
.build(),
PointStruct.newBuilder()
.setId(id(2))
.setId(id(201))
.setVectors(namedVectors(Map.of()))
.putAllPayload(Map.of(
"title", value("Document B"),
@@ -40,12 +40,12 @@ public class Snippet {
PointStruct.newBuilder()
.setId(id(0))
.setVectors(vectors(0.1f, 0.2f, 0.3f, 0.4f))
.putAllPayload(Map.of("document_id", value(1)))
.putAllPayload(Map.of("document_id", value(200)))
.build(),
PointStruct.newBuilder()
.setId(id(1))
.setVectors(vectors(0.5f, 0.6f, 0.7f, 0.8f))
.putAllPayload(Map.of("document_id", value(2)))
.putAllPayload(Map.of("document_id", value(201)))
.build())).get();
}
}
@@ -6,12 +6,12 @@ client.upsert(
collection_name="documents",
points=[
models.PointStruct(
id=1,
id=200,
vector={},
payload={"title": "Document A", "text": "This is document A"},
),
models.PointStruct(
id=2,
id=201,
vector={},
payload={"title": "Document B", "text": "This is document B"},
),
@@ -24,12 +24,12 @@ client.upsert(
models.PointStruct(
id=0,
vector=[0.1, 0.2, 0.3, 0.4],
payload={"document_id": 1},
payload={"document_id": 200},
),
models.PointStruct(
id=1,
vector=[0.5, 0.6, 0.7, 0.8],
payload={"document_id": 2},
payload={"document_id": 201},
),
],
)
@@ -11,7 +11,7 @@ pub async fn main() -> anyhow::Result<()> {
"documents",
vec![
PointStruct::new(
1,
200,
HashMap::<String, Vector>::new(),
[
("title", "Document A".into()),
@@ -19,7 +19,7 @@ pub async fn main() -> anyhow::Result<()> {
],
),
PointStruct::new(
2,
201,
HashMap::<String, Vector>::new(),
[
("title", "Document B".into()),
@@ -34,8 +34,8 @@ pub async fn main() -> anyhow::Result<()> {
.upsert_points(UpsertPointsBuilder::new(
"chunks",
vec![
PointStruct::new(0, vec![0.1, 0.2, 0.3, 0.4], [("document_id", 1.into())]),
PointStruct::new(1, vec![0.5, 0.6, 0.7, 0.8], [("document_id", 2.into())]),
PointStruct::new(0, vec![0.1, 0.2, 0.3, 0.4], [("document_id", 200.into())]),
PointStruct::new(1, vec![0.5, 0.6, 0.7, 0.8], [("document_id", 201.into())]),
],
))
.await?;
@@ -5,12 +5,12 @@ const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
await client.upsert("documents", {
points: [
{
id: 1,
id: 200,
vector: {},
payload: { title: "Document A", text: "This is document A" },
},
{
id: 2,
id: 201,
vector: {},
payload: { title: "Document B", text: "This is document B" },
},
@@ -22,12 +22,12 @@ await client.upsert("chunks", {
{
id: 0,
vector: [0.1, 0.2, 0.3, 0.4],
payload: { document_id: 1 },
payload: { document_id: 200 },
},
{
id: 1,
vector: [0.5, 0.6, 0.7, 0.8],
payload: { document_id: 2 },
payload: { document_id: 201 },
},
],
});