Skip to content

Commit

Permalink
object: Support numerical search queries
Browse files Browse the repository at this point in the history
Previously, protocol did not support numerical search queries for
objects. This may be needed for system attributes such as payload size
or creation epoch, and for user ones if required by the client
application.

New values of `MatchType` enumeration are added: '>', '>=', '<', "<=".
These attributes allow user to search for objects with any decimal
attributes. While only base-10 numbers are allowed, additional bases may
be supported in the future without new enumerations

Note that the previously added `STRING_EQUAL` / `STRING_NOT_EQUAL`
matchers are suitable for numerical '==' / '!='.

Closes #265.

Signed-off-by: Leonard Lyubich <[email protected]>
  • Loading branch information
cthulhu-rider committed Jan 29, 2024
1 parent 8eb21aa commit 2c0cb20
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion object/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,9 @@ message SearchRequest {
// `NOT_PRESENT `is not recommended since this is not a cross-version approach.
// Behavior when processing this kind of filters is undefined.
message Filter {
// Match type to use
// Match type to use. \
// If 'match_type' is numerical, both 'value' and object attribute MUST
// be base-10 numbers.
MatchType match_type = 1 [json_name = "matchType"];

// Attribute or Header fields to match
Expand Down
12 changes: 12 additions & 0 deletions object/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ enum MatchType {

// String prefix match
COMMON_PREFIX = 4;

// Numerical 'greater than'
NUM_GT = 5;

// Numerical 'greater or equal than'
NUM_GE = 6;

// Numerical 'less than'
NUM_LT = 7;

// Numerical 'less or equal than'
NUM_LE = 8;
}

// Short header fields
Expand Down
6 changes: 5 additions & 1 deletion proto-docs/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ Behavior when processing this kind of filters is undefined.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| match_type | [MatchType](#neo.fs.v2.object.MatchType) | | Match type to use |
| match_type | [MatchType](#neo.fs.v2.object.MatchType) | | Match type to use. \ If 'match_type' is numerical, both 'value' and object attribute MUST be base-10 numbers. |
| key | [string](#string) | | Attribute or Header fields to match |
| value | [string](#string) | | Value to match |

Expand Down Expand Up @@ -1021,6 +1021,10 @@ Type of match expression
| STRING_NOT_EQUAL | 2 | Full string mismatch |
| NOT_PRESENT | 3 | Lack of key |
| COMMON_PREFIX | 4 | String prefix match |
| NUM_GT | 5 | Numerical 'greater than' |
| NUM_GE | 6 | Numerical 'greater or equal than' |
| NUM_LT | 7 | Numerical 'less than' |
| NUM_LE | 8 | Numerical 'less or equal than' |



Expand Down

0 comments on commit 2c0cb20

Please sign in to comment.