mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-26 22:48:30 +02:00
Hide boilerplate in snippets.
This commit is contained in:
+2
@@ -5,7 +5,9 @@ public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
// @hide-start
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
// @hide-end
|
||||
|
||||
await client.CreateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
|
||||
-2
@@ -2,8 +2,6 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CreateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
// ... other collection parameters
|
||||
|
||||
-5
@@ -5,11 +5,6 @@ import (
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
// ... other collection parameters
|
||||
|
||||
-3
@@ -6,9 +6,6 @@ import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.CreateCollection;
|
||||
import io.qdrant.client.grpc.Collections.ShardingMethod;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client
|
||||
.createCollectionAsync(
|
||||
CreateCollection.newBuilder()
|
||||
|
||||
-2
@@ -1,8 +1,6 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.create_collection(
|
||||
collection_name="{collection_name}",
|
||||
shard_number=1,
|
||||
|
||||
-2
@@ -4,8 +4,6 @@ use qdrant_client::qdrant::{
|
||||
};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client
|
||||
.create_collection(
|
||||
CreateCollectionBuilder::new("{collection_name}")
|
||||
|
||||
-2
@@ -1,8 +1,6 @@
|
||||
```typescript
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.createCollection("{collection_name}", {
|
||||
shard_number: 1,
|
||||
sharding_method: "custom",
|
||||
|
||||
+3
-1
@@ -7,12 +7,14 @@ import (
|
||||
)
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
|
||||
+2
@@ -9,8 +9,10 @@ import io.qdrant.client.grpc.Collections.ShardingMethod;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
// @hide-start
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
// @hide-end
|
||||
|
||||
client
|
||||
.createCollectionAsync(
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
# @hide-start
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
# @hide-end
|
||||
|
||||
client.create_collection(
|
||||
collection_name="{collection_name}",
|
||||
|
||||
+2
@@ -4,7 +4,9 @@ use qdrant_client::qdrant::{
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
// @hide-start
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
// @hide-end
|
||||
|
||||
client
|
||||
.create_collection(
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
// @hide-start
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
// @hide-end
|
||||
|
||||
client.createCollection("{collection_name}", {
|
||||
shard_number: 1,
|
||||
|
||||
+2
@@ -5,7 +5,9 @@ public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
// @hide-start
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
// @hide-end
|
||||
|
||||
await client.CreateShardKeyAsync(
|
||||
"{collection_name}",
|
||||
|
||||
-2
@@ -2,8 +2,6 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CreateShardKeyAsync(
|
||||
"{collection_name}",
|
||||
new CreateShardKey { ShardKey = new ShardKey { Keyword = "{shard_key}", } }
|
||||
|
||||
-5
@@ -5,11 +5,6 @@ import (
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.CreateShardKey(context.Background(), "{collection_name}", &qdrant.CreateShardKey{
|
||||
ShardKey: qdrant.NewShardKey("{shard_key}"),
|
||||
})
|
||||
|
||||
-3
@@ -6,9 +6,6 @@ import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.CreateShardKey;
|
||||
import io.qdrant.client.grpc.Collections.CreateShardKeyRequest;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client.createShardKeyAsync(CreateShardKeyRequest.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setRequest(CreateShardKey.newBuilder()
|
||||
|
||||
-2
@@ -1,7 +1,5 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.create_shard_key("{collection_name}", "{shard_key}")
|
||||
```
|
||||
|
||||
-2
@@ -4,8 +4,6 @@ use qdrant_client::qdrant::{
|
||||
};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client
|
||||
.create_shard_key(
|
||||
CreateShardKeyRequestBuilder::new("{collection_name}")
|
||||
|
||||
-2
@@ -1,8 +1,6 @@
|
||||
```typescript
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.createShardKey("{collection_name}", {
|
||||
shard_key: "{shard_key}"
|
||||
});
|
||||
|
||||
+3
-1
@@ -7,12 +7,14 @@ import (
|
||||
)
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.CreateShardKey(context.Background(), "{collection_name}", &qdrant.CreateShardKey{
|
||||
ShardKey: qdrant.NewShardKey("{shard_key}"),
|
||||
|
||||
+2
@@ -9,8 +9,10 @@ import io.qdrant.client.grpc.Collections.CreateShardKeyRequest;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
// @hide-start
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
// @hide-end
|
||||
|
||||
client.createShardKeyAsync(CreateShardKeyRequest.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
# @hide-start
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
# @hide-end
|
||||
|
||||
client.create_shard_key("{collection_name}", "{shard_key}")
|
||||
|
||||
+2
@@ -4,7 +4,9 @@ use qdrant_client::qdrant::{
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
// @hide-start
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
// @hide-end
|
||||
|
||||
client
|
||||
.create_shard_key(
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
// @hide-start
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
// @hide-end
|
||||
|
||||
client.createShardKey("{collection_name}", {
|
||||
shard_key: "{shard_key}"
|
||||
|
||||
+2
@@ -5,7 +5,9 @@ public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
// @hide-start
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
// @hide-end
|
||||
|
||||
await client.UpsertAsync(
|
||||
collectionName: "{collection_name}",
|
||||
|
||||
-2
@@ -2,8 +2,6 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.UpsertAsync(
|
||||
collectionName: "{collection_name}",
|
||||
points: new List<PointStruct>
|
||||
|
||||
-5
@@ -5,11 +5,6 @@ import (
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Points: []*qdrant.PointStruct{
|
||||
|
||||
-3
@@ -9,9 +9,6 @@ import io.qdrant.client.grpc.Points.PointStruct;
|
||||
import io.qdrant.client.grpc.Points.UpsertPoints;
|
||||
import java.util.List;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client
|
||||
.upsertAsync(
|
||||
UpsertPoints.newBuilder()
|
||||
|
||||
-2
@@ -1,8 +1,6 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.upsert(
|
||||
collection_name="{collection_name}",
|
||||
points=[
|
||||
|
||||
-2
@@ -1,8 +1,6 @@
|
||||
```typescript
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.upsert("{collection_name}", {
|
||||
points: [
|
||||
{
|
||||
|
||||
+3
-1
@@ -7,12 +7,14 @@ import (
|
||||
)
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
|
||||
+2
@@ -12,8 +12,10 @@ import java.util.List;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
// @hide-start
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
// @hide-end
|
||||
|
||||
client
|
||||
.upsertAsync(
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
# @hide-start
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
# @hide-end
|
||||
|
||||
client.upsert(
|
||||
collection_name="{collection_name}",
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
// @hide-start
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
// @hide-end
|
||||
|
||||
client.upsert("{collection_name}", {
|
||||
points: [
|
||||
|
||||
@@ -4,7 +4,9 @@ public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
// @hide-start
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
// @hide-end
|
||||
|
||||
await client.ListShardKeysAsync("{collection_name}");
|
||||
}
|
||||
|
||||
-2
@@ -1,7 +1,5 @@
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.ListShardKeysAsync("{collection_name}");
|
||||
```
|
||||
|
||||
@@ -5,10 +5,5 @@ import (
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.ListShardKeys(context.Background(), "{collection_name}")
|
||||
```
|
||||
|
||||
-3
@@ -2,8 +2,5 @@
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client.listShardKeysAsync("{collection_name}").get();
|
||||
```
|
||||
|
||||
-2
@@ -1,8 +1,6 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.list_shard_keys(
|
||||
collection_name="{collection_name}",
|
||||
)
|
||||
|
||||
-2
@@ -1,7 +1,5 @@
|
||||
```rust
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client.list_shard_keys("{collection_name}").await?;
|
||||
```
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
)
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
// @hide-start
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@ import io.qdrant.client.QdrantGrpcClient;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
// @hide-start
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
// @hide-end
|
||||
|
||||
client.listShardKeysAsync("{collection_name}").get();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from qdrant_client import QdrantClient
|
||||
|
||||
# @hide-start
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
# @hide-end
|
||||
|
||||
client.list_shard_keys(
|
||||
collection_name="{collection_name}",
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
// @hide-start
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
// @hide-end
|
||||
|
||||
client.list_shard_keys("{collection_name}").await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user