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:
+17
@@ -0,0 +1,17 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
using static Qdrant.Client.Grpc.Conditions;
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.SetPayloadAsync(
|
||||
collectionName: "{collection_name}",
|
||||
payload: new Dictionary<string, Value> { { "property1", "string" }, { "property2", "string" } },
|
||||
filter: MatchKeyword("color", "red")
|
||||
);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
```java
|
||||
import java.util.Map;
|
||||
|
||||
import static io.qdrant.client.ConditionFactory.matchKeyword;
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
client
|
||||
.setPayloadAsync(
|
||||
"{collection_name}",
|
||||
@@ -0,0 +1,25 @@
|
||||
package snippet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
func Main() {
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.SetPayload(context.Background(), &qdrant.SetPayloadPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Payload: qdrant.NewValueMap(
|
||||
map[string]any{"property1": "string", "property2": "string"}),
|
||||
PointsSelector: qdrant.NewPointsSelectorFilter(&qdrant.Filter{
|
||||
Must: []*qdrant.Condition{
|
||||
qdrant.NewMatch("color", "red"),
|
||||
},
|
||||
}),
|
||||
})
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import static io.qdrant.client.ConditionFactory.matchKeyword;
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
client
|
||||
.setPayloadAsync(
|
||||
"{collection_name}",
|
||||
Map.of("property1", value("string"), "property2", value("string")),
|
||||
Filter.newBuilder().addMust(matchKeyword("color", "red")).build(),
|
||||
true,
|
||||
null,
|
||||
null)
|
||||
.get();
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
from qdrant_client import QdrantClient, models # @hide
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333") # @hide
|
||||
|
||||
client.set_payload(
|
||||
collection_name="{collection_name}",
|
||||
payload={
|
||||
"property1": "string",
|
||||
"property2": "string",
|
||||
},
|
||||
points=models.Filter(
|
||||
must=[
|
||||
models.FieldCondition(
|
||||
key="color",
|
||||
match=models.MatchValue(value="red"),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,25 @@
|
||||
use qdrant_client::qdrant::{Condition, Filter, SetPayloadPointsBuilder};
|
||||
use qdrant_client::Payload;
|
||||
use serde_json::json;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
client
|
||||
.set_payload(
|
||||
SetPayloadPointsBuilder::new(
|
||||
"{collection_name}",
|
||||
Payload::try_from(json!({
|
||||
"property1": "string",
|
||||
"property2": "string",
|
||||
}))
|
||||
.unwrap(),
|
||||
)
|
||||
.points_selector(Filter::must([Condition::matches(
|
||||
"color",
|
||||
"red".to_string(),
|
||||
)]))
|
||||
.wait(true),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest"; // @hide
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
|
||||
|
||||
client.setPayload("{collection_name}", {
|
||||
payload: {
|
||||
property1: "string",
|
||||
property2: "string",
|
||||
},
|
||||
filter: {
|
||||
must: [
|
||||
{
|
||||
key: "color",
|
||||
match: {
|
||||
value: "red",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.SetPayloadAsync(
|
||||
collectionName: "{collection_name}",
|
||||
payload: new Dictionary<string, Value> { { "property1", "string" }, { "property2", "string" } },
|
||||
ids: new ulong[] { 0, 3, 10 }
|
||||
);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
```java
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.qdrant.client.PointIdFactory.id;
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
client
|
||||
.setPayloadAsync(
|
||||
"{collection_name}",
|
||||
@@ -0,0 +1,23 @@
|
||||
package snippet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
func Main() {
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.SetPayload(context.Background(), &qdrant.SetPayloadPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Payload: qdrant.NewValueMap(
|
||||
map[string]any{"property1": "string", "property2": "string"}),
|
||||
PointsSelector: qdrant.NewPointsSelector(
|
||||
qdrant.NewIDNum(0),
|
||||
qdrant.NewIDNum(3)),
|
||||
})
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import static io.qdrant.client.PointIdFactory.id;
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
client
|
||||
.setPayloadAsync(
|
||||
"{collection_name}",
|
||||
Map.of("property1", value("string"), "property2", value("string")),
|
||||
List.of(id(0), id(3), id(10)),
|
||||
true,
|
||||
null,
|
||||
null)
|
||||
.get();
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
from qdrant_client import QdrantClient # @hide
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333") # @hide
|
||||
|
||||
client.set_payload(
|
||||
collection_name="{collection_name}",
|
||||
payload={
|
||||
"property1": "string",
|
||||
"property2": "string",
|
||||
},
|
||||
points=[0, 3, 10],
|
||||
)
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
use qdrant_client::qdrant::{
|
||||
PointsIdsList, SetPayloadPointsBuilder,
|
||||
};
|
||||
use qdrant_client::Payload,;
|
||||
use serde_json::json;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
client
|
||||
.set_payload(
|
||||
SetPayloadPointsBuilder::new(
|
||||
"{collection_name}",
|
||||
Payload::try_from(json!({
|
||||
"property1": "string",
|
||||
"property2": "string",
|
||||
}))
|
||||
.unwrap(),
|
||||
)
|
||||
.points_selector(PointsIdsList {
|
||||
ids: vec![0.into(), 3.into(), 10.into()],
|
||||
})
|
||||
.wait(true),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest"; // @hide
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
|
||||
|
||||
client.setPayload("{collection_name}", {
|
||||
payload: {
|
||||
property1: "string",
|
||||
property2: "string",
|
||||
},
|
||||
points: [0, 3, 10],
|
||||
});
|
||||
Reference in New Issue
Block a user