Files
2497c368ed Add code snippets for the text search guide (#2056)
* 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>
2026-01-16 17:57:08 +05:30

38 lines
1.1 KiB
Rust

use qdrant_client::Qdrant;
use qdrant_client::qdrant::{Document, Fusion, PrefetchQueryBuilder, Query, QueryPointsBuilder};
pub async fn main() -> anyhow::Result<()> {
let client = Qdrant::from_url("http://localhost:6334").build()?; // @hide
let dense_prefetch = PrefetchQueryBuilder::default()
.query(Query::new_nearest(Document::new(
"9780553213515",
"sentence-transformers/all-minilm-l6-v2",
)))
.using("description-dense")
.score_threshold(0.5)
.build();
let bm25_prefetch = PrefetchQueryBuilder::default()
.query(Query::new_nearest(Document::new(
"9780553213515",
"Qdrant/bm25",
)))
.using("isbn-bm25")
.build();
client
.query(
QueryPointsBuilder::new("books")
.add_prefetch(dense_prefetch)
.add_prefetch(bm25_prefetch)
.query(Query::new_fusion(Fusion::Rrf))
.limit(10)
.with_payload(true)
.build(),
)
.await?;
Ok(())
}