mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
Automated snippet conversion by scripts
These changes are purely mechanical to differentiate them from manual fixes/adjustments made in the next commit. This results in broken code as some snippets contain errors. Made in four steps: 1. Run ./migrate-snippet.py that converts `.md` files to code files and perhaps adds missing lines under `// @hide` comments. 2. Sort Java imports. 3. Remove old `.md` files. 4. Run ./generate.md to produce `*/generated/*.md` files.
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CreateShardKeyAsync(
|
||||
"{collection_name}",
|
||||
new CreateShardKey { ShardKey = new ShardKey { Keyword = "{shard_key}", } }
|
||||
);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -4,4 +4,4 @@ from qdrant_client import QdrantClient, models
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.create_shard_key("{collection_name}", "{shard_key}")
|
||||
```
|
||||
```
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package snippet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
func Main() {
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.CreateShardKey(context.Background(), "{collection_name}", &qdrant.CreateShardKey{
|
||||
ShardKey: qdrant.NewShardKey("{shard_key}"),
|
||||
})
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import static io.qdrant.client.ShardKeyFactory.shardKey;
|
||||
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.CreateShardKey;
|
||||
import io.qdrant.client.grpc.Collections.CreateShardKeyRequest;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client.createShardKeyAsync(CreateShardKeyRequest.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setRequest(CreateShardKey.newBuilder()
|
||||
.setShardKey(shardKey("{shard_key}"))
|
||||
.build())
|
||||
.build()).get();
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.create_shard_key("{collection_name}", "{shard_key}")
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
use qdrant_client::qdrant::{
|
||||
CreateShardKeyBuilder, CreateShardKeyRequestBuilder
|
||||
};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client
|
||||
.create_shard_key(
|
||||
CreateShardKeyRequestBuilder::new("{collection_name}")
|
||||
.request(CreateShardKeyBuilder::default().shard_key("{shard_key}".to_string())),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.createShardKey("{collection_name}", {
|
||||
shard_key: "{shard_key}"
|
||||
});
|
||||
Reference in New Issue
Block a user