From 8853f84a9523a7585825168c93cd74f016c80a30 Mon Sep 17 00:00:00 2001 From: Anush Date: Tue, 7 May 2024 05:56:44 +0530 Subject: [PATCH] docs: Fix snippets (#868) --- .../documentation/concepts/collections.md | 30 ++++++------ .../content/documentation/concepts/explore.md | 41 ++++++++++++++++ .../content/documentation/concepts/points.md | 47 ++++++++++++++----- .../guides/distributed_deployment.md | 34 +++++++++++++- 4 files changed, 121 insertions(+), 31 deletions(-) diff --git a/qdrant-landing/content/documentation/concepts/collections.md b/qdrant-landing/content/documentation/concepts/collections.md index 98a8b48e1..b4aee9ad9 100644 --- a/qdrant-landing/content/documentation/concepts/collections.md +++ b/qdrant-landing/content/documentation/concepts/collections.md @@ -633,26 +633,24 @@ client.createCollection("{collection_name}", { ```rust use qdrant_client::{ client::QdrantClient, - qdrant::{ - vectors_config::Config, CreateCollection, Distance, SparseVectorParams, VectorParamsMap, - VectorsConfig, - }, + qdrant::{CreateCollection, SparseVectorConfig, SparseVectorParams}, }; + let client = QdrantClient::from_url("http://localhost:6334").build()?; client .create_collection(&CreateCollection { collection_name: "{collection_name}".to_string(), - sparse_vectors_config: Some(SparseVectorsConfig { - map: [ - ( - "text".to_string(), - SparseVectorParams {}, - ), - ] - .into(), - }), + sparse_vectors_config: Some(SparseVectorConfig { + map: [( + "text".to_string(), + SparseVectorParams { + ..Default::default() + }, + )] + .into(), + ..Default::default() }), ..Default::default() }) @@ -786,10 +784,10 @@ use qdrant_client::qdrant::OptimizersConfigDiff; client .update_collection( "{collection_name}", - &OptimizersConfigDiff { + Some(&OptimizersConfigDiff { indexing_threshold: Some(10000), ..Default::default() - }, + }), None, None, None, @@ -1298,7 +1296,7 @@ use qdrant_client::qdrant::OptimizersConfigDiff; client .update_collection( "{collection_name}", - &OptimizersConfigDiff::default(), + Some(&OptimizersConfigDiff::default()), None, None, None, diff --git a/qdrant-landing/content/documentation/concepts/explore.md b/qdrant-landing/content/documentation/concepts/explore.md index 19c213b7a..fe1d6b57b 100644 --- a/qdrant-landing/content/documentation/concepts/explore.md +++ b/qdrant-landing/content/documentation/concepts/explore.md @@ -139,6 +139,22 @@ client .get(); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; +using static Qdrant.Client.Grpc.Conditions; + +var client = new QdrantClient("localhost", 6334); + +await client.RecommendAsync( + "{collection_name}", + positive: new ulong[] { 100, 231 }, + negative: new ulong[] { 718 }, + filter: MatchKeyword("city", "London"), + limit: 3 +); +``` + Example result of this API would be ```json @@ -1012,6 +1028,31 @@ client .get(); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.DiscoverAsync( + collectionName: "{collection_name}", + context: + [ + new() + { + Positive = new VectorExample { Id = 100 }, + Negative = new VectorExample { Id = 718 } + }, + new() + { + Positive = new VectorExample { Id = 200 }, + Negative = new VectorExample { Id = 300 } + } + ], + limit: 10 +); +``` +