Skip to content

Commit

Permalink
fix : Points API Reference
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-gupta-ij committed Jun 21, 2024
1 parent 4605af9 commit b3694b7
Show file tree
Hide file tree
Showing 12 changed files with 1,062 additions and 1,042 deletions.
989 changes: 496 additions & 493 deletions fern/apis/master/openapi-overrides.yml

Large diffs are not rendered by default.

989 changes: 496 additions & 493 deletions fern/apis/v1.9.x/openapi-overrides.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions snippets/csharp/delete_points.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

await client.DeleteAsync(collectionName: "{collection_name}", ids: [0, 3, 100]);

// Delete all points with color = "red"

await client.DeleteAsync(collectionName: "{collection_name}", filter: MatchKeyword("color", "red"));
12 changes: 7 additions & 5 deletions snippets/csharp/search_points.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using Qdrant.Client;
using Qdrant.Client.Grpc;
using static Qdrant.Client.Grpc.Conditions;

var client = new QdrantClient("localhost", 6334);

await client.SearchAsync(
collectionName: "{collection_name}",
vector: new float[] { 0.2f, 0.1f, 0.9f, 0.7f },
filter: MatchKeyword("city", "London"),
limit: 3
);
collectionName: "{collection_name}",
vector: new float[] { 0.2f, 0.1f, 0.9f, 0.7f },
filter: MatchKeyword("city", "London"),
searchParams: new SearchParams { Exact = false, HnswEf = 128 },
limit: 3
);
2 changes: 2 additions & 0 deletions snippets/java/delete_points.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

client.deleteAsync("{collection_name}", List.of(id(0), id(3), id(100)));

// Delete all points with color = "red"

client
.deleteAsync(
"{collection_name}",
Expand Down
11 changes: 7 additions & 4 deletions snippets/java/search_points.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import java.util.List;

import static io.qdrant.client.ConditionFactory.matchKeyword;

import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;

import io.qdrant.client.grpc.Points.Filter;
import io.qdrant.client.grpc.Points.SearchParams;
import io.qdrant.client.grpc.Points.SearchPoints;

QdrantClient client = new QdrantClient(
QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
QdrantClient client =
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());

client
.searchAsync(
SearchPoints.newBuilder()
.setCollectionName("{collection_name}")
.setFilter(Filter.newBuilder().addMust(matchKeyword("city", "London")).build())
.setParams(SearchParams.newBuilder().setExact(false).setHnswEf(128).build())
.addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f))
.setLimit(3)
.build())
.get();
.get();
38 changes: 16 additions & 22 deletions snippets/java/upsert_points.java
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
import static io.qdrant.client.PointIdFactory.id;
import static io.qdrant.client.VectorFactory.vector;
import static io.qdrant.client.VectorsFactory.namedVectors;

import java.util.List;
import java.util.Map;

import static io.qdrant.client.PointIdFactory.id;
import static io.qdrant.client.ValueFactory.value;
import static io.qdrant.client.VectorsFactory.vectors;

import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;

import io.qdrant.client.grpc.Points.PointStruct;

QdrantClient client = new QdrantClient(
QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
QdrantClient client =
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());

client
.upsertAsync(
"{collection_name}",
List.of(
PointStruct.newBuilder()
.setId(id(1))
.setVectors(
namedVectors(
Map.of(
"image",
vector(List.of(0.9f, 0.1f, 0.1f, 0.2f)),
"text",
vector(List.of(0.4f, 0.7f, 0.1f, 0.8f, 0.1f, 0.1f, 0.9f, 0.2f)))))
.setVectors(vectors(0.9f, 0.1f, 0.1f))
.putAllPayload(Map.of("color", value("red")))
.build(),
PointStruct.newBuilder()
.setId(id(2))
.setVectors(
namedVectors(
Map.of(
"image",
List.of(0.2f, 0.1f, 0.3f, 0.9f),
"text",
List.of(0.5f, 0.2f, 0.7f, 0.4f, 0.7f, 0.2f, 0.3f, 0.9f))))
.setVectors(vectors(0.1f, 0.9f, 0.1f))
.putAllPayload(Map.of("color", value("green")))
.build(),
PointStruct.newBuilder()
.setId(id(3))
.setVectors(vectors(0.1f, 0.1f, 0.9f))
.putAllPayload(Map.of("color", value("blue")))
.build()))
.get();
.get();
2 changes: 2 additions & 0 deletions snippets/python/delete_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
),
)

# Delete all points with color = "red"

client.delete(
collection_name="{collection_name}",
points_selector=models.FilterSelector(
Expand Down
3 changes: 2 additions & 1 deletion snippets/python/search_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
)
]
),
search_params=models.SearchParams(hnsw_ef=128, exact=False),
query_vector=[0.2, 0.1, 0.9, 0.7],
limit=3,
)
)
26 changes: 14 additions & 12 deletions snippets/rust/delete_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ client
None,
)
.await?;

// Delete all points with color = "red"

client
.delete_points_blocking(
"{collection_name}",
None,
&PointsSelector {
points_selector_one_of: Some(PointsSelectorOneOf::Filter(Filter::must([
Condition::matches("color", "red".to_string()),
]))),
},
None,
)
.await?;
client
.delete_points_blocking(
"{collection_name}",
None,
&PointsSelector {
points_selector_one_of: Some(PointsSelectorOneOf::Filter(Filter::must([
Condition::matches("color", "red".to_string()),
]))),
},
None,
)
.await?;
2 changes: 2 additions & 0 deletions snippets/typescript/delete_points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ client.delete("{collection_name}", {
points: [0, 3, 100],
});

// Delete all points with color = "red"

client.delete("{collection_name}", {
filter: {
must: [
Expand Down
28 changes: 16 additions & 12 deletions snippets/typescript/search_points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });

client.search("{collection_name}", {
filter: {
must: [
{
key: "city",
match: {
value: "London",
},
},
],
},
vector: [0.2, 0.1, 0.9, 0.7],
limit: 3,
filter: {
must: [
{
key: "city",
match: {
value: "London",
},
},
],
},
params: {
hnsw_ef: 128,
exact: false,
},
vector: [0.2, 0.1, 0.9, 0.7],
limit: 3,
});

0 comments on commit b3694b7

Please sign in to comment.