mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
Add worked with_lookup example
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
2b97750ade
commit
a6104d7b7a
+54
@@ -0,0 +1,54 @@
|
||||
package snippet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
func Main() {
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||
CollectionName: "documents",
|
||||
Points: []*qdrant.PointStruct{
|
||||
{
|
||||
Id: qdrant.NewIDNum(1),
|
||||
Vectors: qdrant.NewVectorsMap(map[string]*qdrant.Vector{}),
|
||||
Payload: qdrant.NewValueMap(map[string]any{
|
||||
"title": "Document A",
|
||||
"text": "This is document A",
|
||||
}),
|
||||
},
|
||||
{
|
||||
Id: qdrant.NewIDNum(2),
|
||||
Vectors: qdrant.NewVectorsMap(map[string]*qdrant.Vector{}),
|
||||
Payload: qdrant.NewValueMap(map[string]any{
|
||||
"title": "Document B",
|
||||
"text": "This is document B",
|
||||
}),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||
CollectionName: "chunks",
|
||||
Points: []*qdrant.PointStruct{
|
||||
{
|
||||
Id: qdrant.NewIDNum(0),
|
||||
Vectors: qdrant.NewVectors(0.1, 0.2, 0.3, 0.4),
|
||||
Payload: qdrant.NewValueMap(map[string]any{"document_id": 1}),
|
||||
},
|
||||
{
|
||||
Id: qdrant.NewIDNum(1),
|
||||
Vectors: qdrant.NewVectors(0.5, 0.6, 0.7, 0.8),
|
||||
Payload: qdrant.NewValueMap(map[string]any{"document_id": 2}),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user