Skip to content

Commit d7b3d9a

Browse files
committed
Add support for replicate_points
1 parent 1178d0d commit d7b3d9a

File tree

9 files changed

+601
-402
lines changed

9 files changed

+601
-402
lines changed

proto/collections.proto

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package qdrant;
44
option csharp_namespace = "Qdrant.Client.Grpc";
55

66
import "json_with_int.proto";
7+
import "google/protobuf/timestamp.proto";
78

89
enum Datatype {
910
Default = 0;
@@ -12,6 +13,149 @@ enum Datatype {
1213
Float16 = 3;
1314
}
1415

16+
message PointId {
17+
oneof point_id_options {
18+
uint64 num = 1; // Numerical ID of the point
19+
string uuid = 2; // UUID
20+
}
21+
}
22+
23+
message GeoPoint {
24+
double lon = 1;
25+
double lat = 2;
26+
}
27+
28+
// ---------------------------------------------
29+
// ------------- Filter Conditions -------------
30+
// ---------------------------------------------
31+
32+
message Filter {
33+
repeated Condition should = 1; // At least one of those conditions should match
34+
repeated Condition must = 2; // All conditions must match
35+
repeated Condition must_not = 3; // All conditions must NOT match
36+
optional MinShould min_should = 4; // At least minimum amount of given conditions should match
37+
}
38+
39+
message MinShould {
40+
repeated Condition conditions = 1;
41+
uint64 min_count = 2;
42+
}
43+
44+
message Condition {
45+
oneof condition_one_of {
46+
FieldCondition field = 1;
47+
IsEmptyCondition is_empty = 2;
48+
HasIdCondition has_id = 3;
49+
Filter filter = 4;
50+
IsNullCondition is_null = 5;
51+
NestedCondition nested = 6;
52+
HasVectorCondition has_vector = 7;
53+
}
54+
}
55+
56+
message IsEmptyCondition {
57+
string key = 1;
58+
}
59+
60+
message IsNullCondition {
61+
string key = 1;
62+
}
63+
64+
message HasIdCondition {
65+
repeated PointId has_id = 1;
66+
}
67+
68+
message HasVectorCondition {
69+
string has_vector = 1;
70+
}
71+
72+
message NestedCondition {
73+
string key = 1; // Path to nested object
74+
Filter filter = 2; // Filter condition
75+
}
76+
77+
message FieldCondition {
78+
string key = 1;
79+
Match match = 2; // Check if point has field with a given value
80+
Range range = 3; // Check if points value lies in a given range
81+
GeoBoundingBox geo_bounding_box = 4; // Check if points geolocation lies in a given area
82+
GeoRadius geo_radius = 5; // Check if geo point is within a given radius
83+
ValuesCount values_count = 6; // Check number of values for a specific field
84+
GeoPolygon geo_polygon = 7; // Check if geo point is within a given polygon
85+
DatetimeRange datetime_range = 8; // Check if datetime is within a given range
86+
optional bool is_empty = 9; // Check if field is empty
87+
optional bool is_null = 10; // Check if field is null
88+
}
89+
90+
message Match {
91+
oneof match_value {
92+
string keyword = 1; // Match string keyword
93+
int64 integer = 2; // Match integer
94+
bool boolean = 3; // Match boolean
95+
string text = 4; // Match text
96+
RepeatedStrings keywords = 5; // Match multiple keywords
97+
RepeatedIntegers integers = 6; // Match multiple integers
98+
RepeatedIntegers except_integers = 7; // Match any other value except those integers
99+
RepeatedStrings except_keywords = 8; // Match any other value except those keywords
100+
string phrase = 9; // Match phrase text
101+
string text_any = 10; // Match any word in the text
102+
}
103+
}
104+
105+
message RepeatedStrings {
106+
repeated string strings = 1;
107+
}
108+
109+
message RepeatedIntegers {
110+
repeated int64 integers = 1;
111+
}
112+
113+
message Range {
114+
optional double lt = 1;
115+
optional double gt = 2;
116+
optional double gte = 3;
117+
optional double lte = 4;
118+
}
119+
120+
message DatetimeRange {
121+
optional google.protobuf.Timestamp lt = 1;
122+
optional google.protobuf.Timestamp gt = 2;
123+
optional google.protobuf.Timestamp gte = 3;
124+
optional google.protobuf.Timestamp lte = 4;
125+
}
126+
127+
message GeoBoundingBox {
128+
GeoPoint top_left = 1; // north-west corner
129+
GeoPoint bottom_right = 2; // south-east corner
130+
}
131+
132+
message GeoRadius {
133+
GeoPoint center = 1; // Center of the circle
134+
float radius = 2; // In meters
135+
}
136+
137+
message GeoLineString {
138+
repeated GeoPoint points = 1; // Ordered sequence of GeoPoints representing the line
139+
}
140+
141+
// For a valid GeoPolygon, both the exterior and interior GeoLineStrings must consist of a minimum of 4 points.
142+
// Additionally, the first and last points of each GeoLineString must be the same.
143+
message GeoPolygon {
144+
GeoLineString exterior = 1; // The exterior line bounds the surface
145+
repeated GeoLineString interiors = 2; // Interior lines (if present) bound holes within the surface
146+
}
147+
148+
message ValuesCount {
149+
optional uint64 lt = 1;
150+
optional uint64 gt = 2;
151+
optional uint64 gte = 3;
152+
optional uint64 lte = 4;
153+
}
154+
155+
// ---------------------------------------------
156+
// ------------- Collection Config -------------
157+
// ---------------------------------------------
158+
15159
message VectorParams {
16160
uint64 size = 1; // Size of the vectors
17161
Distance distance = 2; // Distance function used for comparing vectors
@@ -724,6 +868,12 @@ message RestartTransfer {
724868
ShardTransferMethod method = 4;
725869
}
726870

871+
message ReplicatePoints {
872+
ShardKey from_shard_key = 1; // Source shard key
873+
ShardKey to_shard_key = 2; // Target shard key
874+
optional Filter filter = 3; // If set - only points matching the filter will be replicated
875+
}
876+
727877
enum ShardTransferMethod {
728878
StreamRecords = 0; // Stream shard records in batches
729879
Snapshot = 1; // Snapshot the shard and recover it on the target peer
@@ -758,6 +908,7 @@ message UpdateCollectionClusterSetupRequest {
758908
CreateShardKey create_shard_key = 7;
759909
DeleteShardKey delete_shard_key = 8;
760910
RestartTransfer restart_transfer = 9;
911+
ReplicatePoints replicate_points = 10;
761912
}
762913
optional uint64 timeout = 6; // Wait timeout for operation commit in seconds, if not specified - default value will be supplied
763914
}

proto/points.proto

Lines changed: 0 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ message ReadConsistency {
3131
}
3232
}
3333

34-
// ---------------------------------------------
35-
// ------------- Point Id Requests -------------
36-
// ---------------------------------------------
37-
38-
message PointId {
39-
oneof point_id_options {
40-
uint64 num = 1; // Numerical ID of the point
41-
string uuid = 2; // UUID
42-
}
43-
}
44-
4534
message SparseIndices {
4635
repeated uint32 data = 1;
4736
}
@@ -1075,133 +1064,6 @@ message SearchMatrixOffsetsResponse {
10751064
optional Usage usage = 3;
10761065
}
10771066

1078-
// ---------------------------------------------
1079-
// ------------- Filter Conditions -------------
1080-
// ---------------------------------------------
1081-
1082-
message Filter {
1083-
repeated Condition should = 1; // At least one of those conditions should match
1084-
repeated Condition must = 2; // All conditions must match
1085-
repeated Condition must_not = 3; // All conditions must NOT match
1086-
optional MinShould min_should = 4; // At least minimum amount of given conditions should match
1087-
}
1088-
1089-
message MinShould {
1090-
repeated Condition conditions = 1;
1091-
uint64 min_count = 2;
1092-
}
1093-
1094-
message Condition {
1095-
oneof condition_one_of {
1096-
FieldCondition field = 1;
1097-
IsEmptyCondition is_empty = 2;
1098-
HasIdCondition has_id = 3;
1099-
Filter filter = 4;
1100-
IsNullCondition is_null = 5;
1101-
NestedCondition nested = 6;
1102-
HasVectorCondition has_vector = 7;
1103-
}
1104-
}
1105-
1106-
message IsEmptyCondition {
1107-
string key = 1;
1108-
}
1109-
1110-
message IsNullCondition {
1111-
string key = 1;
1112-
}
1113-
1114-
message HasIdCondition {
1115-
repeated PointId has_id = 1;
1116-
}
1117-
1118-
message HasVectorCondition {
1119-
string has_vector = 1;
1120-
}
1121-
1122-
message NestedCondition {
1123-
string key = 1; // Path to nested object
1124-
Filter filter = 2; // Filter condition
1125-
}
1126-
1127-
message FieldCondition {
1128-
string key = 1;
1129-
Match match = 2; // Check if point has field with a given value
1130-
Range range = 3; // Check if points value lies in a given range
1131-
GeoBoundingBox geo_bounding_box = 4; // Check if points geolocation lies in a given area
1132-
GeoRadius geo_radius = 5; // Check if geo point is within a given radius
1133-
ValuesCount values_count = 6; // Check number of values for a specific field
1134-
GeoPolygon geo_polygon = 7; // Check if geo point is within a given polygon
1135-
DatetimeRange datetime_range = 8; // Check if datetime is within a given range
1136-
optional bool is_empty = 9; // Check if field is empty
1137-
optional bool is_null = 10; // Check if field is null
1138-
}
1139-
1140-
message Match {
1141-
oneof match_value {
1142-
string keyword = 1; // Match string keyword
1143-
int64 integer = 2; // Match integer
1144-
bool boolean = 3; // Match boolean
1145-
string text = 4; // Match text
1146-
RepeatedStrings keywords = 5; // Match multiple keywords
1147-
RepeatedIntegers integers = 6; // Match multiple integers
1148-
RepeatedIntegers except_integers = 7; // Match any other value except those integers
1149-
RepeatedStrings except_keywords = 8; // Match any other value except those keywords
1150-
string phrase = 9; // Match phrase text
1151-
string text_any = 10; // Match any word in the text
1152-
}
1153-
}
1154-
1155-
message RepeatedStrings {
1156-
repeated string strings = 1;
1157-
}
1158-
1159-
message RepeatedIntegers {
1160-
repeated int64 integers = 1;
1161-
}
1162-
1163-
message Range {
1164-
optional double lt = 1;
1165-
optional double gt = 2;
1166-
optional double gte = 3;
1167-
optional double lte = 4;
1168-
}
1169-
1170-
message DatetimeRange {
1171-
optional google.protobuf.Timestamp lt = 1;
1172-
optional google.protobuf.Timestamp gt = 2;
1173-
optional google.protobuf.Timestamp gte = 3;
1174-
optional google.protobuf.Timestamp lte = 4;
1175-
}
1176-
1177-
message GeoBoundingBox {
1178-
GeoPoint top_left = 1; // north-west corner
1179-
GeoPoint bottom_right = 2; // south-east corner
1180-
}
1181-
1182-
message GeoRadius {
1183-
GeoPoint center = 1; // Center of the circle
1184-
float radius = 2; // In meters
1185-
}
1186-
1187-
message GeoLineString {
1188-
repeated GeoPoint points = 1; // Ordered sequence of GeoPoints representing the line
1189-
}
1190-
1191-
// For a valid GeoPolygon, both the exterior and interior GeoLineStrings must consist of a minimum of 4 points.
1192-
// Additionally, the first and last points of each GeoLineString must be the same.
1193-
message GeoPolygon {
1194-
GeoLineString exterior = 1; // The exterior line bounds the surface
1195-
repeated GeoLineString interiors = 2; // Interior lines (if present) bound holes within the surface
1196-
}
1197-
1198-
message ValuesCount {
1199-
optional uint64 lt = 1;
1200-
optional uint64 gt = 2;
1201-
optional uint64 gte = 3;
1202-
optional uint64 lte = 4;
1203-
}
1204-
12051067
// ---------------------------------------------
12061068
// -------------- Points Selector --------------
12071069
// ---------------------------------------------
@@ -1229,12 +1091,6 @@ message PointStruct {
12291091
optional Vectors vectors = 4;
12301092
}
12311093

1232-
1233-
message GeoPoint {
1234-
double lon = 1;
1235-
double lat = 2;
1236-
}
1237-
12381094
// ---------------------------------------------
12391095
// ----------- Measurements collector ----------
12401096
// ---------------------------------------------

src/builders/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ pub use move_shard_builder::MoveShardBuilder;
8888
mod replicate_shard_builder;
8989
pub use replicate_shard_builder::ReplicateShardBuilder;
9090

91+
mod replicate_points_builder;
92+
pub use replicate_points_builder::ReplicatePointsBuilder;
93+
9194
mod abort_shard_transfer_builder;
9295
pub use abort_shard_transfer_builder::AbortShardTransferBuilder;
9396

0 commit comments

Comments
 (0)