@@ -42,6 +42,9 @@ message MatchRequest {
42
42
// The list of restricts.
43
43
repeated Namespace restricts = 4 ;
44
44
45
+ //The list of numeric restricts.
46
+ repeated NumericNamespace numeric_restricts = 11 ;
47
+
45
48
// Crowding is a constraint on a neighbor list produced by nearest neighbor
46
49
// search requiring that no more than some value k' of the k neighbors
47
50
// returned have the same value of crowding_attribute.
@@ -88,6 +91,9 @@ message Embedding {
88
91
// The list of restricts.
89
92
repeated Namespace restricts = 3 ;
90
93
94
+ // The list of numeric restricts.
95
+ repeated NumericNamespace numeric_restricts = 5 ;
96
+
91
97
// The attribute value used for crowding. The maximum number of neighbors
92
98
// to return per crowding attribute value
93
99
// (per_crowding_attribute_num_neighbors) is configured per-query.
@@ -175,6 +181,7 @@ message BatchMatchResponse {
175
181
176
182
// Namespace specifies the rules for determining the datapoints that are
177
183
// eligible for each matching query, overall query is an AND across namespaces.
184
+ // This uses categorical tokens.
178
185
message Namespace {
179
186
// The string name of the namespace that this proto is specifying,
180
187
// such as "color", "shape", "geo", or "tags".
@@ -192,4 +199,53 @@ message Namespace {
192
199
// query will match datapoints that are red or blue, but if those points are
193
200
// also purple, then they will be excluded even if they are red/blue.
194
201
repeated string deny_tokens = 3 ;
195
- }
202
+ }
203
+
204
+ // NumericNamespace specifies the rules for determining the datapoints that are
205
+ // eligible for each matching query, overall query is an AND across namespaces.
206
+ // This uses numeric comparisons.
207
+ message NumericNamespace {
208
+
209
+ // The string name of the namespace that this proto is specifying,
210
+ // such as "size" or "cost".
211
+ string name = 1 ;
212
+
213
+ // The type of Value must be consistent for all datapoints with a given
214
+ // namespace name. This is verified at runtime.
215
+ oneof Value {
216
+ // Represents 64 bit integer.
217
+ int64 value_int = 2 ;
218
+ // Represents 32 bit float.
219
+ float value_float = 3 ;
220
+ // Represents 64 bit float.
221
+ double value_double = 4 ;
222
+ }
223
+
224
+ // Which comparison operator to use. Should be specified for queries only;
225
+ // specifying this for a datapoint is an error.
226
+ //
227
+ // Datapoints for which Operator is true relative to the query's Value
228
+ // field will be allowlisted.
229
+ enum Operator {
230
+ // Default value of the enum.
231
+ OPERATOR_UNSPECIFIED = 0 ;
232
+
233
+ // Datapoints are eligible iff their value is < the query's.
234
+ LESS = 1 ;
235
+
236
+ // Datapoints are eligible iff their value is <= the query's.
237
+ LESS_EQUAL = 2 ;
238
+
239
+ // Datapoints are eligible iff their value is == the query's.
240
+ EQUAL = 3 ;
241
+
242
+ // Datapoints are eligible iff their value is >= the query's.
243
+ GREATER_EQUAL = 4 ;
244
+
245
+ // Datapoints are eligible iff their value is > the query's.
246
+ GREATER = 5 ;
247
+ }
248
+
249
+ // Which comparison operator to use.
250
+ Operator op = 5 ;
251
+ }
0 commit comments