mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-11 05:48:31 +02:00
Add code snippets for the text search guide (#2056)
* Python snippets * TS snippets * Rust snippets * Java snippets * C# snippets * Go snippets * Generate .md files * Hide client connection in Rust snippets * Switch to builder pattern for Rust snippets * Use Document::new instead of DocumentBuilder::new * docs: Updated Go snippets Signed-off-by: Anush008 <mail@anush.sh> * docs: Updated Java snippets Signed-off-by: Anush008 <anushshetty90@gmail.com> * docs: Updated C# snippets Signed-off-by: Anush008 <anushshetty90@gmail.com> * docs: Updated BM25 avg_len Java snippet Signed-off-by: Anush008 <anushshetty90@gmail.com> * chore: review and format rust snippets * chore: trigger pr update * chore: remove qdrant_storage folder * fix: remove tokio::main * chore: trigger pr update * Regenerate .md files * George's feedback: set bm25 params at ingest-time, change Python client init to use cloud inference explicitly, and mark bm25 options unavailable in FastEmbed --------- Signed-off-by: Anush008 <mail@anush.sh> Signed-off-by: Anush008 <anushshetty90@gmail.com> Co-authored-by: Anush008 <mail@anush.sh> Co-authored-by: Anush008 <anushshetty90@gmail.com> Co-authored-by: Daniel Boros <dancixx@gmail.com>
This commit is contained in:
co-authored by
Anush008
Anush008
Daniel Boros
parent
b5e0908946
commit
2497c368ed
+40
@@ -0,0 +1,40 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import static io.qdrant.client.PointIdFactory.id;
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
import static io.qdrant.client.VectorFactory.vector;
|
||||
import static io.qdrant.client.VectorsFactory.namedVectors;
|
||||
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Points.*;
|
||||
import java.util.*;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); // @hide
|
||||
|
||||
PointStruct point =
|
||||
PointStruct.newBuilder()
|
||||
.setId(id(1))
|
||||
.setVectors(
|
||||
namedVectors(
|
||||
Map.of(
|
||||
"title-bm25",
|
||||
vector(
|
||||
Document.newBuilder()
|
||||
.setText("The Time Machine")
|
||||
.setModel("qdrant/bm25")
|
||||
.putOptions("avg_len", value(5.0))
|
||||
.build()))))
|
||||
.putAllPayload(
|
||||
Map.of(
|
||||
"title", value("The Time Machine"),
|
||||
"author", value("H.G. Wells"),
|
||||
"isbn", value("9780553213515")))
|
||||
.build();
|
||||
|
||||
client.upsertAsync("books", List.of(point)).get();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user