@@ -42,6 +42,9 @@ message MatchRequest {
4242 // The list of restricts.
4343 repeated Namespace restricts = 4 ;
4444
45+ //The list of numeric restricts.
46+ repeated NumericNamespace numeric_restricts = 11 ;
47+
4548 // Crowding is a constraint on a neighbor list produced by nearest neighbor
4649 // search requiring that no more than some value k' of the k neighbors
4750 // returned have the same value of crowding_attribute.
@@ -88,6 +91,9 @@ message Embedding {
8891 // The list of restricts.
8992 repeated Namespace restricts = 3 ;
9093
94+ // The list of numeric restricts.
95+ repeated NumericNamespace numeric_restricts = 5 ;
96+
9197 // The attribute value used for crowding. The maximum number of neighbors
9298 // to return per crowding attribute value
9399 // (per_crowding_attribute_num_neighbors) is configured per-query.
@@ -175,6 +181,7 @@ message BatchMatchResponse {
175181
176182// Namespace specifies the rules for determining the datapoints that are
177183// eligible for each matching query, overall query is an AND across namespaces.
184+ // This uses categorical tokens.
178185message Namespace {
179186 // The string name of the namespace that this proto is specifying,
180187 // such as "color", "shape", "geo", or "tags".
@@ -192,4 +199,53 @@ message Namespace {
192199 // query will match datapoints that are red or blue, but if those points are
193200 // also purple, then they will be excluded even if they are red/blue.
194201 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