mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-04 10:28:29 +02:00
docs: Go, Java, C# snippets
Signed-off-by: Anush008 <anushshetty90@gmail.com>
This commit is contained in:
+9
-12
@@ -2,21 +2,17 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.qdrant.client.ShardKeyFactory.shardKey;
|
||||
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Points.PointStruct;
|
||||
|
||||
import io.qdrant.client.ShardKeyFactory.shardKey;
|
||||
import io.qdrant.client.grpc.Points.ShardKeySelector;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
ShardKeySelector.Builder shardkeySelectorBuilder = ShardKeySelector.newBuilder();
|
||||
shardkeySelectorBuilder.addShardKeys(shardKey("user_1"));
|
||||
shardkeySelectorBuilder.setFallback(shardKey("default"));
|
||||
ShardKeySelector shardKeySelector = shardkeySelectorBuilder.build();
|
||||
|
||||
client
|
||||
.upsertAsync(
|
||||
UpsertPoints.newBuilder()
|
||||
@@ -27,11 +23,12 @@ client
|
||||
.setId(id(1))
|
||||
.setVectors(vectors(0.9f, 0.1f, 0.1f))
|
||||
.putAllPayload(Map.of("group_id", value("user_1")))
|
||||
.build()
|
||||
)
|
||||
)
|
||||
.setShardKeySelector(shardKeySelector)
|
||||
.build()
|
||||
)
|
||||
.build()))
|
||||
.setShardKeySelector(
|
||||
ShardKeySelector.newBuilder()
|
||||
.addShardKeys(shardKey("user_1"))
|
||||
.setFallback(shardKey("default"))
|
||||
.build())
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
|
||||
+10
-3
@@ -5,7 +5,14 @@ using static Qdrant.Client.Grpc.Conditions;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
TODO!
|
||||
|
||||
|
||||
await client.UpdateCollectionClusterSetupAsync(new()
|
||||
{
|
||||
CollectionName = "{collection_name}",
|
||||
ReplicatePoints = new()
|
||||
{
|
||||
FromShardKey = "default",
|
||||
ToShardKey = "user_1",
|
||||
Filter = MatchKeyword("group_id", "user_1")
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
+11
-1
@@ -10,5 +10,15 @@ client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
TODO!
|
||||
client.UpdateClusterCollectionSetup(ctx, qdrant.NewUpdateCollectionClusterReplicatePoints(
|
||||
"{collection_name}", &qdrant.ReplicatePoints{
|
||||
FromShardKey: qdrant.NewShardKey("default"),
|
||||
ToShardKey: qdrant.NewShardKey("user_1"),
|
||||
Filter: &qdrant.Filter{
|
||||
Must: []*qdrant.Condition{
|
||||
qdrant.NewMatch("group_id", "user_1"),
|
||||
},
|
||||
},
|
||||
},
|
||||
))
|
||||
```
|
||||
|
||||
+17
-8
@@ -1,20 +1,29 @@
|
||||
```java
|
||||
import java.util.List;
|
||||
|
||||
import static io.qdrant.client.ConditionFactory.matchKeyword;
|
||||
import static io.qdrant.client.QueryFactory.nearest;
|
||||
import static io.qdrant.client.ShardKeyFactory.shardKey;
|
||||
|
||||
import io.qdrant.client.grpc.Collections.ReplicatePoints;
|
||||
import io.qdrant.client.grpc.Collections.UpdateCollectionClusterSetupRequest;
|
||||
import io.qdrant.client.grpc.Points.Filter;
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Points.Filter;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
|
||||
// .setFilter(Filter.newBuilder().addMust(matchKeyword("group_id", "user_1")).build())
|
||||
|
||||
|
||||
TODO!
|
||||
|
||||
client
|
||||
.updateCollectionClusterSetupAsync(
|
||||
UpdateCollectionClusterSetupRequest.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setReplicatePoints(
|
||||
ReplicatePoints.newBuilder()
|
||||
.setFromShardKey(shardKey("default"))
|
||||
.setToShardKey(shardKey("user_1"))
|
||||
.setFilter(
|
||||
Filter.newBuilder().addMust(matchKeyword("group_id", "user_1")).build())
|
||||
.build())
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user