Skip to content

Commit

Permalink
docs: Query API snippets with TS (#1093)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anush008 authored Aug 23, 2024
1 parent e9fa9be commit 879e8e4
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 210 deletions.
168 changes: 97 additions & 71 deletions qdrant-landing/content/documentation/concepts/explore.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,25 @@ import { QdrantClient } from "@qdrant/js-client-rest";

const client = new QdrantClient({ host: "localhost", port: 6333 });

client.recommend("{collection_name}", {
positive: [100, 231],
negative: [718, [0.2, 0.3, 0.4, 0.5]],
strategy: "average_vector",
filter: {
must: [
{
key: "city",
match: {
value: "London",
},
},
],
},
limit: 3,
client.query("{collection_name}", {
query: {
recommend: {
positive: [100, 231],
negative: [718, [0.2, 0.3, 0.4, 0.5]],
strategy: "average_vector"
}
},
filter: {
must: [
{
key: "city",
match: {
value: "London",
},
},
],
},
limit: 3
});
```

Expand Down Expand Up @@ -263,11 +267,15 @@ client.query_points(
```

```typescript
client.recommend("{collection_name}", {
positive: [100, 231],
negative: [718],
using: "image",
limit: 10,
client.query("{collection_name}", {
query: {
recommend: {
positive: [100, 231],
negative: [718],
}
},
using: "image",
limit: 10
});
```

Expand Down Expand Up @@ -375,15 +383,19 @@ client.query_points(
```

```typescript
client.recommend("{collection_name}", {
positive: [100, 231],
negative: [718],
using: "image",
limit: 10,
lookup_from: {
"collection" : "{external_collection_name}",
"vector" : "{external_vector_name}"
client.query("{collection_name}", {
query: {
recommend: {
positive: [100, 231],
negative: [718],
}
},
using: "image",
limit: 10,
lookup_from: {
collection: "{external_collection_name}",
vector: "{external_vector_name}"
}
});
```

Expand Down Expand Up @@ -558,33 +570,41 @@ import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });

const filter = {
must: [
{
key: "city",
match: {
value: "London",
},
},
],
must: [
{
key: "city",
match: {
value: "London",
},
},
],
};

const searches = [
{
positive: [100, 231],
negative: [718],
filter,
limit: 3,
},
{
positive: [200, 67],
negative: [300],
filter,
limit: 3,
},
{
query: {
recommend: {
positive: [100, 231],
negative: [718]
}
},
filter,
limit: 3,
},
{
query: {
recommend: {
positive: [200, 67],
negative: [300]
}
},
filter,
limit: 3,
},
];

client.recommend_batch("{collection_name}", {
searches,
client.queryBatch("{collection_name}", {
searches,
});
```

Expand Down Expand Up @@ -825,18 +845,22 @@ import { QdrantClient } from "@qdrant/js-client-rest";

const client = new QdrantClient({ host: "localhost", port: 6333 });

client.discover("{collection_name}", {
target: [0.2, 0.1, 0.9, 0.7],
context: [
{
positive: 100,
negative: 718,
},
{
positive: 200,
negative: 300,
client.query("{collection_name}", {
query: {
discover: {
target: [0.2, 0.1, 0.9, 0.7],
context: [
{
positive: 100,
negative: 718,
},
{
positive: 200,
negative: 300,
},
],
}
},
],
limit: 10,
});
```
Expand Down Expand Up @@ -998,17 +1022,19 @@ import { QdrantClient } from "@qdrant/js-client-rest";

const client = new QdrantClient({ host: "localhost", port: 6333 });

client.discover("{collection_name}", {
context: [
{
positive: 100,
negative: 718,
},
{
positive: 200,
negative: 300,
client.query("{collection_name}", {
query: {
context: [
{
positive: 100,
negative: 718,
},
{
positive: 200,
negative: 300,
},
]
},
],
limit: 10,
});
```
Expand Down
Loading

0 comments on commit 879e8e4

Please sign in to comment.