From e4a52cc53713452769b9418276a4b09ece31d9b5 Mon Sep 17 00:00:00 2001 From: generall Date: Sat, 18 May 2024 19:47:35 +0200 Subject: [PATCH] add rust example --- .../documentation/concepts/indexing.md | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/qdrant-landing/content/documentation/concepts/indexing.md b/qdrant-landing/content/documentation/concepts/indexing.md index 7ae80b4eb..c657524fc 100644 --- a/qdrant-landing/content/documentation/concepts/indexing.md +++ b/qdrant-landing/content/documentation/concepts/indexing.md @@ -526,8 +526,28 @@ client.createCollection("{collection_name}", { ```rust -ToDo: Add Rust example +use qdrant_client::{client::QdrantClient, qdrant::collections::SparseVectorIndexConfig}; +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.create_collection(&CreateCollection { + collection_name: "{collection_name}".to_string(), + sparse_vectors_config: Some(SparseVectorConfig { + map: [ + ( + "splade-model-name".to_string(), + SparseVectorParams { + index: Some(SparseIndexConfig { + on_disk: false, + ..Default::default() + }), + ..Default::default() + } + ) + ].into_iter().collect() + }), + ..Default::default() +}).await; ```