mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
Fix type-checking errors in snippets (code only, no .md)
This commit both: - Fixes pre-existing mistakes in snippets, aka wrong code samples. - Adds hidden (`@hide`) statements that do not appear in the docs, but satisfy typecheckers.
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334); // @hide
|
||||
await client.FacetAsync(
|
||||
"{collection_name}",
|
||||
key: "size",
|
||||
exact: true,
|
||||
exact: true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
package snippet
|
||||
|
||||
// @hide-start
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
// @hide-end
|
||||
|
||||
|
||||
func Main() {
|
||||
res, err := client.Facet(ctx, &qdrant.FacetCounts{
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
res, err := client.Facet(context.Background(), &qdrant.FacetCounts{
|
||||
CollectionName: "{collection_name}",
|
||||
Key: "key",
|
||||
Exact: true,
|
||||
Exact: qdrant.PtrOf(true),
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
_ = res // @hide
|
||||
}
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import io.qdrant.client.grpc.Points.FacetCounts;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
// @hide-start
|
||||
io.qdrant.client.QdrantClient client =
|
||||
new io.qdrant.client.QdrantClient(io.qdrant.client.QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
// @hide-end
|
||||
|
||||
client
|
||||
.facetAsync(
|
||||
Points.FacetCounts.newBuilder()
|
||||
.setCollectionName(collection_name)
|
||||
FacetCounts.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setKey("foo")
|
||||
.setExact(true)
|
||||
.build())
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use qdrant_client::qdrant::FacetCountsBuilder;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client
|
||||
.facet(
|
||||
FacetCountsBuilder::new("{collection_name}", "size")
|
||||
|
||||
+6
-1
@@ -12,7 +12,9 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
res, err := client.Facet(ctx, &qdrant.FacetCounts{
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
res, err := client.Facet(context.Background(), &qdrant.FacetCounts{
|
||||
CollectionName: "{collection_name}",
|
||||
Key: "size",
|
||||
Filter: &qdrant.Filter{
|
||||
@@ -21,4 +23,7 @@ func Main() {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
_ = res // @hide
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import static io.qdrant.client.ConditionFactory.matchKeyword;
|
||||
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Filter;
|
||||
import io.qdrant.client.grpc.Common.Filter;
|
||||
import io.qdrant.client.grpc.Points;
|
||||
|
||||
public class Snippet {
|
||||
@@ -15,7 +15,7 @@ public class Snippet {
|
||||
client
|
||||
.facetAsync(
|
||||
Points.FacetCounts.newBuilder()
|
||||
.setCollectionName(collection_name)
|
||||
.setCollectionName("{collection_name}")
|
||||
.setKey("size")
|
||||
.setFilter(Filter.newBuilder().addMust(matchKeyword("color", "red")).build())
|
||||
.build())
|
||||
|
||||
+8
-1
@@ -5,5 +5,12 @@ client = QdrantClient(url="http://localhost:6333")
|
||||
client.facet(
|
||||
collection_name="{collection_name}",
|
||||
key="size",
|
||||
facet_filter=models.Filter(must=[models.Match("color", "red")]),
|
||||
facet_filter=models.Filter(
|
||||
must=[
|
||||
models.FieldCondition(
|
||||
key="color",
|
||||
match=models.MatchValue(value="red"),
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user