mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
* Python snippets * TS snippets * Rust snippets * Java snippets * C# snippets * Go snippets * Generate .md files * Hide client connection in Rust snippets * Switch to builder pattern for Rust snippets * Use Document::new instead of DocumentBuilder::new * docs: Updated Go snippets Signed-off-by: Anush008 <mail@anush.sh> * docs: Updated Java snippets Signed-off-by: Anush008 <anushshetty90@gmail.com> * docs: Updated C# snippets Signed-off-by: Anush008 <anushshetty90@gmail.com> * docs: Updated BM25 avg_len Java snippet Signed-off-by: Anush008 <anushshetty90@gmail.com> * chore: review and format rust snippets * chore: trigger pr update * chore: remove qdrant_storage folder * fix: remove tokio::main * chore: trigger pr update * Regenerate .md files * George's feedback: set bm25 params at ingest-time, change Python client init to use cloud inference explicitly, and mark bm25 options unavailable in FastEmbed --------- Signed-off-by: Anush008 <mail@anush.sh> Signed-off-by: Anush008 <anushshetty90@gmail.com> Co-authored-by: Anush008 <mail@anush.sh> Co-authored-by: Anush008 <anushshetty90@gmail.com> Co-authored-by: Daniel Boros <dancixx@gmail.com>
33 lines
1.1 KiB
Rust
33 lines
1.1 KiB
Rust
use std::collections::HashMap;
|
|
|
|
use qdrant_client::qdrant::{Document, 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()?; // @hide
|
|
|
|
let point = PointStruct::new(
|
|
1,
|
|
HashMap::from([(
|
|
"description-dense".to_string(),
|
|
Document::new(
|
|
"A Victorian scientist builds a device to travel far into the future and observes the dim trajectories of humanity. He discovers evolutionary divergence and the consequences of class division. Wells's novella established time travel as a vehicle for social commentary.",
|
|
"sentence-transformers/all-minilm-l6-v2",
|
|
),
|
|
)]),
|
|
Payload::try_from(json!({
|
|
"title": "The Time Machine",
|
|
"author": "H.G. Wells",
|
|
"isbn": "9780553213515",
|
|
}))
|
|
.unwrap(),
|
|
);
|
|
|
|
client
|
|
.upsert_points(UpsertPointsBuilder::new("books", vec![point]).wait(true))
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|