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:
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ client.create_payload_index(
|
||||
collection_name="{collection_name}",
|
||||
field_name="name_of_the_field_to_index",
|
||||
field_schema=models.TextIndexParams(
|
||||
type="text",
|
||||
type=models.TextIndexType.TEXT,
|
||||
tokenizer=models.TokenizerType.WORD,
|
||||
ascii_folding=True,
|
||||
),
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@ package com.example.snippets_amalgamation;
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.IntegerIndexParams;
|
||||
import io.qdrant.client.grpc.Collections.KeywordIndexParams;
|
||||
import io.qdrant.client.grpc.Collections.PayloadIndexParams;
|
||||
import io.qdrant.client.grpc.Collections.PayloadSchemaType;
|
||||
|
||||
@@ -18,8 +19,8 @@ public class Snippet {
|
||||
PayloadSchemaType.Integer,
|
||||
PayloadIndexParams.newBuilder()
|
||||
.setIntegerIndexParams(
|
||||
KeywordIndexParams.newBuilder()
|
||||
.setIsPrincipa(true)
|
||||
IntegerIndexParams.newBuilder()
|
||||
.setIsPrincipal(true)
|
||||
.build())
|
||||
.build(),
|
||||
null,
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ use qdrant_client::qdrant::{
|
||||
IntegerIndexParamsBuilder,
|
||||
FieldType
|
||||
};
|
||||
use qdrant_client::{Qdrant, QdrantError};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
@@ -18,7 +18,7 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
IntegerIndexParamsBuilder::default()
|
||||
.is_principal(true),
|
||||
),
|
||||
);
|
||||
).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+4
-2
@@ -12,14 +12,16 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
FieldType: qdrant.FieldType_FieldTypeInteger.Enum(),
|
||||
FieldIndexParams: qdrant.NewPayloadIndexParamsInt(
|
||||
&qdrant.IntegerIndexParams{
|
||||
Lookup: false,
|
||||
Range: true,
|
||||
Lookup: qdrant.PtrOf(false),
|
||||
Range: qdrant.PtrOf(true),
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
+4
-10
@@ -1,8 +1,7 @@
|
||||
use qdrant_client::qdrant::{
|
||||
payload_index_params::IndexParams, CreateFieldIndexCollectionBuilder, FieldType,
|
||||
IntegerIndexParams, PayloadIndexParams,
|
||||
};
|
||||
use qdrant_client::Qdrant;
|
||||
use qdrant_client::qdrant::{
|
||||
CreateFieldIndexCollectionBuilder, FieldType, IntegerIndexParamsBuilder,
|
||||
};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
@@ -14,12 +13,7 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
"name_of_the_field_to_index",
|
||||
FieldType::Integer,
|
||||
)
|
||||
.field_index_params(PayloadIndexParams {
|
||||
index_params: Some(IndexParams::IntegerIndexParams(IntegerIndexParams {
|
||||
lookup: false,
|
||||
range: true,
|
||||
})),
|
||||
}),
|
||||
.field_index_params(IntegerIndexParamsBuilder::new(false, true).build()),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+3
-2
@@ -3,7 +3,8 @@ use qdrant_client::qdrant::{
|
||||
KeywordIndexParamsBuilder,
|
||||
FieldType
|
||||
};
|
||||
use qdrant_client::{Qdrant, QdrantError};
|
||||
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
@@ -18,7 +19,7 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
KeywordIndexParamsBuilder::default()
|
||||
.is_tenant(true),
|
||||
),
|
||||
);
|
||||
).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ use qdrant_client::qdrant::{
|
||||
KeywordIndexParamsBuilder,
|
||||
FieldType
|
||||
};
|
||||
use qdrant_client::{Qdrant, QdrantError};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
@@ -18,7 +18,7 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
KeywordIndexParamsBuilder::default()
|
||||
.on_disk(true),
|
||||
),
|
||||
);
|
||||
).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ client.create_payload_index(
|
||||
collection_name="{collection_name}",
|
||||
field_name="name_of_the_field_to_index",
|
||||
field_schema=models.TextIndexParams(
|
||||
type="text",
|
||||
type=models.TextIndexType.TEXT,
|
||||
tokenizer=models.TokenizerType.WORD,
|
||||
lowercase=False,
|
||||
),
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ client.create_payload_index(
|
||||
collection_name="{collection_name}",
|
||||
field_name="name_of_the_field_to_index",
|
||||
field_schema=models.TextIndexParams(
|
||||
type="text",
|
||||
type=models.TextIndexType.TEXT,
|
||||
tokenizer=models.TokenizerType.WORD,
|
||||
lowercase=True,
|
||||
phrase_matching=True,
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ client.create_payload_index(
|
||||
collection_name="{collection_name}",
|
||||
field_name="name_of_the_field_to_index",
|
||||
field_schema=models.TextIndexParams(
|
||||
type="text",
|
||||
type=models.TextIndexType.TEXT,
|
||||
tokenizer=models.TokenizerType.WORD,
|
||||
min_token_len=2,
|
||||
max_token_len=10,
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+5
@@ -4,6 +4,11 @@ import io.qdrant.client.grpc.Collections.PayloadSchemaType;
|
||||
|
||||
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.createPayloadIndexAsync(
|
||||
"{collection_name}",
|
||||
"name_of_the_field_to_index",
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
use qdrant_client::qdrant::{CreateFieldIndexCollectionBuilder, FieldType};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client
|
||||
.create_field_index(
|
||||
CreateFieldIndexCollectionBuilder::new(
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ client.create_payload_index(
|
||||
collection_name="{collection_name}",
|
||||
field_name="name_of_the_field_to_index",
|
||||
field_schema=models.TextIndexParams(
|
||||
type="text",
|
||||
type=models.TextIndexType.TEXT,
|
||||
tokenizer=models.TokenizerType.WORD,
|
||||
stemmer=models.SnowballParams(
|
||||
type=models.Snowball.SNOWBALL,
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "name_of_the_field_to_index",
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ client.create_payload_index(
|
||||
collection_name="{collection_name}",
|
||||
field_name="name_of_the_field_to_index",
|
||||
field_schema=models.TextIndexParams(
|
||||
type="text",
|
||||
type=models.TextIndexType.TEXT,
|
||||
tokenizer=models.TokenizerType.WORD,
|
||||
stopwords=models.Language.ENGLISH,
|
||||
),
|
||||
@@ -18,7 +18,7 @@ client.create_payload_index(
|
||||
collection_name="{collection_name}",
|
||||
field_name="name_of_the_field_to_index",
|
||||
field_schema=models.TextIndexParams(
|
||||
type="text",
|
||||
type=models.TextIndexType.TEXT,
|
||||
tokenizer=models.TokenizerType.WORD,
|
||||
stopwords=models.StopwordsSet(
|
||||
languages=[
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateFieldIndex(context.Background(), &qdrant.CreateFieldIndexCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
FieldName: "group_id",
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ client.create_payload_index(
|
||||
collection_name="{collection_name}",
|
||||
field_name="group_id",
|
||||
field_schema=models.KeywordIndexParams(
|
||||
type="keyword",
|
||||
type=models.KeywordIndexType.KEYWORD,
|
||||
is_tenant=True,
|
||||
),
|
||||
)
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ use qdrant_client::qdrant::{
|
||||
KeywordIndexParamsBuilder,
|
||||
FieldType
|
||||
};
|
||||
use qdrant_client::{Qdrant, QdrantError};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
Reference in New Issue
Block a user