mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
This commit both: - Fixes pre-existing mistakes in snippets, aka wrong code samples. - Adds hidden (`@hide`) statements that do not appear in the docs, but satisfy typecheckers.
33 lines
962 B
Rust
33 lines
962 B
Rust
use qdrant_client::qdrant::{PointStruct, UpsertPointsBuilder};
|
|
use qdrant_client::{Payload, Qdrant};
|
|
use serde_json::json;
|
|
|
|
pub async fn main() -> anyhow::Result<()> {
|
|
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
|
|
|
let points = vec![
|
|
PointStruct::new(
|
|
1,
|
|
vec![0.05, 0.61, 0.76, 0.74],
|
|
Payload::try_from(json!({"city": "Berlin", "price": 1.99})).unwrap(),
|
|
),
|
|
PointStruct::new(
|
|
2,
|
|
vec![0.19, 0.81, 0.75, 0.11],
|
|
Payload::try_from(json!({"city": ["Berlin", "London"]})).unwrap(),
|
|
),
|
|
PointStruct::new(
|
|
3,
|
|
vec![0.36, 0.55, 0.47, 0.94],
|
|
Payload::try_from(json!({"city": ["Berlin", "Moscow"], "price": [1.99, 2.99]}))
|
|
.unwrap(),
|
|
),
|
|
];
|
|
|
|
client
|
|
.upsert_points(UpsertPointsBuilder::new("{collection_name}", points).wait(true))
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|