From 92714b7bbf3896847fd2bb77bb4036ca784560d0 Mon Sep 17 00:00:00 2001 From: jojii Date: Fri, 4 Oct 2024 11:06:55 +0200 Subject: [PATCH] add examples --- src/qdrant_client/points.rs | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/qdrant_client/points.rs b/src/qdrant_client/points.rs index d3eb2f1..023f84e 100644 --- a/src/qdrant_client/points.rs +++ b/src/qdrant_client/points.rs @@ -502,6 +502,28 @@ impl Qdrant { .await } + /// Get the amount of records for each unique value of a field. + /// + /// ```no_run + ///# use qdrant_client::{Qdrant, QdrantError}; + /// use qdrant_client::qdrant::{Condition, FacetCountsBuilder, Filter}; + /// + ///# async fn facets(client: &Qdrant) + ///# -> Result<(), QdrantError> { + /// let ten_countries_with_most_points_in_europe = client + /// .facet( + /// FacetCountsBuilder::new("world_data", "country") + /// .limit(10) + /// .filter(Filter::must(vec![Condition::matches( + /// "continent", + /// "Europe".to_string(), + /// )])), + /// ) + /// .await + /// .unwrap(); + ///# Ok(()) + ///# } + /// ``` pub async fn facet(&self, request: impl Into) -> QdrantResult { let request = &request.into(); @@ -512,6 +534,28 @@ impl Qdrant { .await } + /// Get a (sparse) matrix of points with closest distance, returned as pairs. + /// + /// ```no_run + ///# use qdrant_client::{Qdrant, QdrantError}; + /// use qdrant_client::qdrant::{Condition, SearchMatrixPointsBuilder, Filter}; + /// + ///# async fn search_matrix_pairs(client: &Qdrant) + ///# -> Result<(), QdrantError> { + /// let matrix = client + /// .search_matrix_pairs( + /// SearchMatrixPointsBuilder::new("collection_name") + /// .filter(Filter::must(vec![Condition::matches( + /// "color", + /// "red".to_string(), + /// )])) + /// .sample(1000) + /// .limit(10), + /// ) + /// .await?; + ///# Ok(()) + ///# } + /// ``` pub async fn search_matrix_pairs( &self, request: impl Into, @@ -525,6 +569,28 @@ impl Qdrant { .await } + /// Get a (sparse) matrix of points with closest distance. + /// + /// ```no_run + ///# use qdrant_client::{Qdrant, QdrantError}; + /// use qdrant_client::qdrant::{Condition, SearchMatrixPointsBuilder, Filter}; + /// + ///# async fn search_matrix_offsets(client: &Qdrant) + ///# -> Result<(), QdrantError> { + /// let matrix = client + /// .search_matrix_offsets( + /// SearchMatrixPointsBuilder::new("collection_name") + /// .filter(Filter::must(vec![Condition::matches( + /// "color", + /// "red".to_string(), + /// )])) + /// .sample(1000) + /// .limit(10), + /// ) + /// .await?; + ///# Ok(()) + ///# } + /// ``` pub async fn search_matrix_offsets( &self, request: impl Into,