mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-25 22:18:30 +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:
+7
-1
@@ -12,6 +12,7 @@ import io.qdrant.client.grpc.Points.PointsUpdateOperation.ClearPayload;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.DeletePayload;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.DeletePoints;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.DeleteVectors;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.OverwritePayload;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.PointStructList;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.SetPayload;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.UpdateVectors;
|
||||
@@ -22,6 +23,11 @@ import java.util.Map;
|
||||
|
||||
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
|
||||
.batchUpdateAsync(
|
||||
"{collection_name}",
|
||||
@@ -58,7 +64,7 @@ public class Snippet {
|
||||
.build(),
|
||||
PointsUpdateOperation.newBuilder()
|
||||
.setOverwritePayload(
|
||||
SetPayload.newBuilder()
|
||||
OverwritePayload.newBuilder()
|
||||
.setPointsSelector(
|
||||
PointsSelector.newBuilder()
|
||||
.setPoints(PointsIdsList.newBuilder().addIds(id(1)).build())
|
||||
|
||||
+2
@@ -10,6 +10,8 @@ use qdrant_client::qdrant::{
|
||||
use qdrant_client::Payload;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client
|
||||
.update_points_batch(
|
||||
UpdateBatchPointsBuilder::new(
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
|
||||
using Qdrant.Client; // @hide
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334); // @hide
|
||||
await client.CollectionExistsAsync("{collection_name}");
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -1,7 +1,16 @@
|
||||
package snippet
|
||||
|
||||
import "context"
|
||||
import "github.com/qdrant/go-client/qdrant" // @hide
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.CollectionExists(context.Background(), "my_collection")
|
||||
}
|
||||
|
||||
+4
@@ -2,6 +2,10 @@ package com.example.snippets_amalgamation;
|
||||
|
||||
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.collectionExistsAsync("{collection_name}").get();
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client.collection_exists("{collection_name}").await?;
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -7,6 +7,14 @@ import (
|
||||
)
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.ClearPayload(context.Background(), &qdrant.ClearPayloadPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Points: qdrant.NewPointsSelector(
|
||||
|
||||
@@ -6,6 +6,11 @@ import java.util.List;
|
||||
|
||||
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
|
||||
.clearPayloadAsync("{collection_name}", List.of(id(0), id(3), id(100)), true, null, null)
|
||||
.get();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use qdrant_client::qdrant::{ClearPayloadPointsBuilder, PointsIdsList};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client
|
||||
.clear_payload(
|
||||
ClearPayloadPointsBuilder::new("{collection_name}")
|
||||
|
||||
+4
-1
@@ -1,9 +1,12 @@
|
||||
|
||||
using Qdrant.Client; // @hide
|
||||
using Qdrant.Client.Grpc; // @hide
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334); // @hide
|
||||
|
||||
await client.CreateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
vectorsConfig: new VectorParamsMap
|
||||
|
||||
+10
-1
@@ -1,8 +1,17 @@
|
||||
package snippet
|
||||
|
||||
|
||||
import "context" // @hide
|
||||
import "github.com/qdrant/go-client/qdrant" // @hide
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfigMap(
|
||||
|
||||
+14
-7
@@ -8,9 +8,15 @@ import io.qdrant.client.grpc.Collections.SparseVectorParams;
|
||||
import io.qdrant.client.grpc.Collections.VectorParams;
|
||||
import io.qdrant.client.grpc.Collections.VectorParamsMap;
|
||||
import io.qdrant.client.grpc.Collections.VectorsConfig;
|
||||
import java.util.Map;
|
||||
|
||||
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
|
||||
.createCollectionAsync(
|
||||
CreateCollection.newBuilder()
|
||||
@@ -26,13 +32,14 @@ public class Snippet {
|
||||
.setSize(384)
|
||||
.setDistance(Distance.Cosine)
|
||||
.build())))
|
||||
.setSparseVectorsConfig(
|
||||
SparseVectorConfig.newBuilder()
|
||||
.putMap(
|
||||
"bm25_sparse_vector",
|
||||
SparseVectorParams.newBuilder()
|
||||
.setModifier(Modifier.Idf)
|
||||
.build())))
|
||||
.build())
|
||||
.setSparseVectorsConfig(
|
||||
SparseVectorConfig.newBuilder()
|
||||
.putMap(
|
||||
"bm25_sparse_vector",
|
||||
SparseVectorParams.newBuilder()
|
||||
.setModifier(Modifier.Idf)
|
||||
.build()))
|
||||
.build())
|
||||
.get();
|
||||
}
|
||||
|
||||
+2
@@ -4,6 +4,8 @@ use qdrant_client::qdrant::{
|
||||
};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
let mut vector_config = VectorsConfigBuilder::default();
|
||||
vector_config.add_named_vector_params(
|
||||
"dense_vector",
|
||||
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var queryText = "What is relapsing polychondritis?"
|
||||
var queryText = "What is relapsing polychondritis?";
|
||||
_ = queryText; // @hide
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package snippet
|
||||
|
||||
|
||||
|
||||
func Main() {
|
||||
queryText := "What is relapsing polychondritis?"
|
||||
_ = queryText // @hide
|
||||
}
|
||||
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let query_text = "What is relapsing polychondritis?";
|
||||
|
||||
_ = query_text; // @hide
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+4
-5
@@ -1,10 +1,6 @@
|
||||
package snippet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
import "github.com/qdrant/go-client/qdrant"
|
||||
|
||||
func Main() {
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
@@ -13,4 +9,7 @@ func Main() {
|
||||
APIKey: "<paste-your-api-key-here>",
|
||||
UseTLS: true,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
_ = client // @hide
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
from qdrant_client import QdrantClient
|
||||
|
||||
qdrant_client = QdrantClient(
|
||||
client = QdrantClient(
|
||||
"xyz-example.cloud-region.cloud-provider.cloud.qdrant.io",
|
||||
api_key="<paste-your-api-key-here>",
|
||||
cloud_inference=True,
|
||||
timeout=30.0
|
||||
timeout=30,
|
||||
)
|
||||
|
||||
+2
-2
@@ -1,6 +1,4 @@
|
||||
use qdrant_client::Qdrant;
|
||||
use qdrant_client::qdrant::{Document};
|
||||
use qdrant_client::qdrant::{PointStruct, UpsertPointsBuilder};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("https://xyz-example.qdrant.io:6334")
|
||||
@@ -8,5 +6,7 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
_ = client; // @hide
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+9
-1
@@ -1,9 +1,17 @@
|
||||
|
||||
using Qdrant.Client; // @hide
|
||||
using Qdrant.Client.Grpc; // @hide
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
// @hide-start
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
var queryText = "{query_text}";
|
||||
var denseModel = "{dense_model_name}";
|
||||
var bm25Model = "{bm25_model_name}";
|
||||
// @hide-end
|
||||
|
||||
await client.QueryAsync(
|
||||
collectionName: "{collection_name}", prefetch: new List <PrefetchQuery> {
|
||||
new() {
|
||||
|
||||
+14
-2
@@ -1,8 +1,20 @@
|
||||
package snippet
|
||||
|
||||
|
||||
import "context" // @hide
|
||||
import "github.com/qdrant/go-client/qdrant" // @hide
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
queryText := "{query_text}"
|
||||
denseModel := "{dense_model_name}"
|
||||
bm25Model := "{bm25_model_name}"
|
||||
// @hide-end
|
||||
|
||||
prefetch := []*qdrant.PrefetchQuery{
|
||||
{
|
||||
Query: qdrant.NewQueryDocument(&qdrant.Document{
|
||||
@@ -20,7 +32,7 @@ func Main() {
|
||||
},
|
||||
}
|
||||
|
||||
client.Query(ctx, &qdrant.QueryPoints{
|
||||
client.Query(context.Background(), &qdrant.QueryPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Prefetch: prefetch,
|
||||
Query: qdrant.NewQueryFusion(qdrant.Fusion_RRF),
|
||||
|
||||
+8
@@ -10,6 +10,14 @@ import io.qdrant.client.grpc.Points.QueryPoints;
|
||||
|
||||
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());
|
||||
String queryText = "{query_text}";
|
||||
String denseModel = "{dense_model_name}";
|
||||
String bm25Model = "{bm25_model_name}";
|
||||
// @hide-end
|
||||
|
||||
PrefetchQuery densePrefetch =
|
||||
PrefetchQuery.newBuilder()
|
||||
.setQuery(
|
||||
|
||||
+9
-4
@@ -1,12 +1,17 @@
|
||||
from qdrant_client import QdrantClient, models # @hide
|
||||
# @hide-start
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333") # @hide
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
query_text = "{query_text}"
|
||||
dense_model = "{dense_model_name}"
|
||||
bm25_model = "{bm25_model_name}"
|
||||
# @hide-end
|
||||
|
||||
results = client.query_points(
|
||||
collection_name="{collection_name}",
|
||||
prefetch=[
|
||||
models.Prefetch(
|
||||
query=Document(
|
||||
query=models.Document(
|
||||
text=query_text,
|
||||
model=dense_model
|
||||
),
|
||||
@@ -14,7 +19,7 @@ results = client.query_points(
|
||||
limit=5
|
||||
),
|
||||
models.Prefetch(
|
||||
query=Document(
|
||||
query=models.Document(
|
||||
text=query_text,
|
||||
model=bm25_model
|
||||
),
|
||||
|
||||
+10
-1
@@ -1,6 +1,13 @@
|
||||
use qdrant_client::qdrant::{Document, Fusion, PrefetchQueryBuilder, Query, QueryPointsBuilder};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
// @hide-start
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?;
|
||||
let query_text = "{query_text}";
|
||||
let dense_model = "{dense_model_name}";
|
||||
let bm25_model = "{bm25_model_name}";
|
||||
// @hide-end
|
||||
|
||||
let dense_prefetch = PrefetchQueryBuilder::default()
|
||||
.query(Query::new_nearest(Document::new(query_text, dense_model)))
|
||||
.using("dense_vector")
|
||||
@@ -11,7 +18,7 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
.using("bm25_sparse_vector")
|
||||
.build();
|
||||
|
||||
let query_request = QueryPointsBuilder::new(collection_name)
|
||||
let query_request = QueryPointsBuilder::new("{collection_name}")
|
||||
.add_prefetch(dense_prefetch)
|
||||
.add_prefetch(bm25_prefetch)
|
||||
.query(Query::new_fusion(Fusion::Rrf))
|
||||
@@ -20,5 +27,7 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
|
||||
let results = client.query(query_request).await?;
|
||||
|
||||
_ = results; // @hide
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+9
-3
@@ -1,8 +1,14 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest"; // @hide
|
||||
// @hide-start
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
const results = await client.query(collectionName, {
|
||||
const queryText = "{query_text}";
|
||||
const denseModel = "{dense_model_name}";
|
||||
const bm25Model = "{bm25_model_name}";
|
||||
// @hide-end
|
||||
|
||||
const results = await client.query("{collection_name}", {
|
||||
prefetch: [
|
||||
{
|
||||
query: {
|
||||
|
||||
+10
-1
@@ -1,13 +1,22 @@
|
||||
|
||||
using Qdrant.Client; // @hide
|
||||
using Qdrant.Client.Grpc; // @hide
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334); // @hide
|
||||
|
||||
var denseModel = "sentence-transformers/all-minilm-l6-v2";
|
||||
var bm25Model = "qdrant/bm25";
|
||||
// NOTE: LoadDataset is a user-defined function.
|
||||
// Implement it to handle dataset loading as needed.
|
||||
// @hide-start
|
||||
List<Dictionary<string, object>> LoadDataset(string path, string slice)
|
||||
{
|
||||
return new List<Dictionary<string, object>> {};
|
||||
}
|
||||
// @hide-end
|
||||
var dataset = LoadDataset("miriad/miriad-4.4M", "train[0:100]");
|
||||
var points = new List<PointStruct>();
|
||||
|
||||
|
||||
+21
-2
@@ -1,8 +1,27 @@
|
||||
package snippet
|
||||
|
||||
// @hide-start
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
func loadDataset(name string, split string) []map[string]string {
|
||||
return []map[string]string{}
|
||||
}
|
||||
// @hide-end
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
denseModel := "sentence-transformers/all-minilm-l6-v2"
|
||||
bm25Model := "qdrant/bm25"
|
||||
// NOTE: loadDataset is a user-defined function.
|
||||
@@ -27,8 +46,8 @@ func Main() {
|
||||
}
|
||||
points = append(points, point)
|
||||
}
|
||||
_, err = client.Upsert(ctx, &qdrant.UpsertPoints{
|
||||
CollectionName: "{collection_name},
|
||||
_, err = client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Points: points,
|
||||
})
|
||||
}
|
||||
|
||||
+14
-3
@@ -1,8 +1,8 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import static io.qdrant.client.PointIdFactory.id;
|
||||
import static io.qdrant.client.VectorFactory.vector;
|
||||
import static io.qdrant.client.VectorsFactory.namedVectors;
|
||||
import static io.qdrant.client.VectorsFactory.vectors;
|
||||
|
||||
import io.qdrant.client.grpc.Points.Document;
|
||||
import io.qdrant.client.grpc.Points.PointStruct;
|
||||
@@ -12,7 +12,18 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Snippet {
|
||||
// @hide-start
|
||||
private static List<Map<String, String>> loadDataset(String name, String split) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// @hide-end
|
||||
|
||||
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
|
||||
|
||||
String denseModel = "sentence-transformers/all-minilm-l6-v2";
|
||||
String bm25Model = "qdrant/bm25";
|
||||
// NOTE: loadDataset is a user-defined function.
|
||||
@@ -29,10 +40,10 @@ public class Snippet {
|
||||
namedVectors(
|
||||
Map.of(
|
||||
"dense_vector",
|
||||
vectors(
|
||||
vector(
|
||||
Document.newBuilder().setText(passage).setModel(denseModel).build()),
|
||||
"bm25_sparse_vector",
|
||||
vectors(
|
||||
vector(
|
||||
Document.newBuilder().setText(passage).setModel(bm25Model).build()))))
|
||||
.build();
|
||||
points.add(point);
|
||||
|
||||
+9
-1
@@ -2,12 +2,20 @@ use qdrant_client::qdrant::{
|
||||
Document, NamedVectors, PointStruct, UpsertPointsBuilder,
|
||||
};
|
||||
use qdrant_client::Payload;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
let dense_model = "sentence-transformers/all-minilm-l6-v2";
|
||||
let bm25_model = "qdrant/bm25";
|
||||
// NOTE: load_dataset is a user-defined function.
|
||||
// Implement it to handle dataset loading as needed.
|
||||
// @hide-start
|
||||
fn load_dataset(_path: &str, _slice: &str) -> Vec<serde_json::Value> {
|
||||
vec![]
|
||||
}
|
||||
// @hide-end
|
||||
let dataset: Vec<_> = load_dataset("miriad/miriad-4.4M", "train[0:100]");
|
||||
|
||||
let points: Vec<PointStruct> = dataset
|
||||
@@ -29,7 +37,7 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
.collect();
|
||||
|
||||
client
|
||||
.upsert_points(UpsertPointsBuilder::new(collection_name, points))
|
||||
.upsert_points(UpsertPointsBuilder::new("{collection_name}", points))
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
|
||||
+5
@@ -8,6 +8,11 @@ const denseModel = "sentence-transformers/all-minilm-l6-v2";
|
||||
const bm25Model = "qdrant/bm25";
|
||||
// NOTE: loadDataset is a user-defined function.
|
||||
// Implement it to handle dataset loading as needed.
|
||||
// @hide-start
|
||||
function loadDataset(name: string, slice: string): Array<{ passage_text: string }> {
|
||||
return [];
|
||||
}
|
||||
// @hide-end
|
||||
const dataset = loadDataset("miriad/miriad-4.4M", "train[0:100]");
|
||||
|
||||
const points = dataset.map((item) => {
|
||||
|
||||
+3
-1
@@ -1,9 +1,11 @@
|
||||
|
||||
using Qdrant.Client; // @hide
|
||||
using Qdrant.Client.Grpc; // @hide
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334); // @hide
|
||||
await client.CreateAliasAsync(aliasName: "production_collection", collectionName: "example_collection");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
package snippet
|
||||
|
||||
import "context"
|
||||
import "github.com/qdrant/go-client/qdrant" // @hide
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.CreateAlias(context.Background(), "production_collection", "example_collection")
|
||||
}
|
||||
|
||||
+5
@@ -2,6 +2,11 @@ package com.example.snippets_amalgamation;
|
||||
|
||||
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.createAliasAsync("production_collection", "example_collection").get();
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
use qdrant_client::qdrant::CreateAliasBuilder;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client
|
||||
.create_alias(CreateAliasBuilder::new(
|
||||
"example_collection",
|
||||
|
||||
+3
-1
@@ -1,9 +1,11 @@
|
||||
|
||||
using Qdrant.Client; // @hide
|
||||
using Qdrant.Client.Grpc; // @hide
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334); // @hide
|
||||
await client.DeleteAliasAsync("production_collection");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
package snippet
|
||||
|
||||
import "context"
|
||||
import "github.com/qdrant/go-client/qdrant" // @hide
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.DeleteAlias(context.Background(), "production_collection")
|
||||
}
|
||||
|
||||
+5
@@ -2,6 +2,11 @@ package com.example.snippets_amalgamation;
|
||||
|
||||
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.deleteAliasAsync("production_collection").get();
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client.delete_alias("production_collection").await?;
|
||||
|
||||
Ok(())
|
||||
|
||||
+2
@@ -12,5 +12,7 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.ListAliases(context.Background())
|
||||
}
|
||||
|
||||
@@ -12,5 +12,7 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.ListCollectionAliases(context.Background(), "{collection_name}")
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,9 +1,11 @@
|
||||
|
||||
using Qdrant.Client; // @hide
|
||||
using Qdrant.Client.Grpc; // @hide
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334); // @hide
|
||||
await client.DeleteAliasAsync("production_collection");
|
||||
await client.CreateAliasAsync(aliasName: "production_collection", collectionName: "example_collection");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
package snippet
|
||||
|
||||
import "context"
|
||||
import "github.com/qdrant/go-client/qdrant" // @hide
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.DeleteAlias(context.Background(), "production_collection")
|
||||
client.CreateAlias(context.Background(), "production_collection", "example_collection")
|
||||
}
|
||||
|
||||
+5
@@ -2,6 +2,11 @@ package com.example.snippets_amalgamation;
|
||||
|
||||
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.deleteAliasAsync("production_collection").get();
|
||||
client.createAliasAsync("production_collection", "example_collection").get();
|
||||
}
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
use qdrant_client::qdrant::CreateAliasBuilder;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client.delete_alias("production_collection").await?;
|
||||
client
|
||||
.create_alias(CreateAliasBuilder::new(
|
||||
|
||||
+3
-1
@@ -1,9 +1,11 @@
|
||||
|
||||
using Qdrant.Client; // @hide
|
||||
using Qdrant.Client.Grpc; // @hide
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334); // @hide
|
||||
await client.GetCollectionInfoAsync("{collection_name}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
package snippet
|
||||
|
||||
import "context"
|
||||
import "github.com/qdrant/go-client/qdrant" // @hide
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
client.GetCollectionInfo(context.Background(), "{collection_name}")
|
||||
}
|
||||
|
||||
+5
@@ -2,6 +2,11 @@ package com.example.snippets_amalgamation;
|
||||
|
||||
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.getCollectionInfoAsync("{collection_name}").get();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client.collection_info("{collection_name}").await?;
|
||||
|
||||
Ok(())
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.Count(context.Background(), &qdrant.CountPoints{
|
||||
CollectionName: "midlib",
|
||||
Filter: &qdrant.Filter{
|
||||
|
||||
+5
@@ -6,6 +6,11 @@ import io.qdrant.client.grpc.Common.Filter;
|
||||
|
||||
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
|
||||
.countAsync(
|
||||
"{collection_name}",
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
use qdrant_client::qdrant::{Condition, CountPointsBuilder, Filter};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
client
|
||||
.count(
|
||||
CountPointsBuilder::new("{collection_name}")
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.Datatype;
|
||||
import io.qdrant.client.grpc.Collections.Distance;
|
||||
import io.qdrant.client.grpc.Collections.VectorParams;
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfigMap(
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfigMap(
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
SparseVectorsConfig: qdrant.NewSparseVectorsConfig(
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
use qdrant_client::qdrant::{
|
||||
CreateCollectionBuilder, Modifier, SparseVectorParamsBuilder, SparseVectorsConfigBuilder,
|
||||
};
|
||||
use qdrant_client::{Qdrant, QdrantError};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
SparseVectorsConfig: qdrant.NewSparseVectorsConfig(
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
SparseVectorsConfig: qdrant.NewSparseVectorsConfig(
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+3
-1
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
@@ -20,7 +22,7 @@ func Main() {
|
||||
}),
|
||||
QuantizationConfig: qdrant.NewQuantizationBinary(
|
||||
&qdrant.BinaryQuantization{
|
||||
QueryEncoding: qdrant.NewBinaryQuantizationQueryEncodingSetting(BinaryQuantizationQueryEncoding_Scalar8Bits),
|
||||
QueryEncoding: qdrant.NewBinaryQuantizationQueryEncodingSetting(qdrant.BinaryQuantizationQueryEncoding_Scalar8Bits),
|
||||
AlwaysRam: qdrant.PtrOf(true),
|
||||
},
|
||||
),
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
// ... other collection parameters
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
use qdrant_client::Qdrant;
|
||||
use qdrant_client::qdrant::{
|
||||
BinaryQuantizationBuilder, CreateCollectionBuilder, Distance, HnswConfigDiffBuilder,
|
||||
VectorParamsBuilder,
|
||||
};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ func Main() {
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
|
||||
+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(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user