From 8988cadf65e075c7ae610bb51174ee018874258c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 19 Feb 2025 15:55:21 +0300 Subject: [PATCH 1/2] object: Free from sorting by secondary attributes in SearchV2 There are currently no known use cases where it is necessary and/or could be more efficient. For example, NeoFS S3 Gateway requests timestamps, but it is interested in their descending order (fresh data first). Therefore, for now, secondary sorting is left to the apps. Refs #306. Signed-off-by: Leonard Lyubich --- object/service.proto | 4 ++-- proto-docs/object.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/object/service.proto b/object/service.proto index 28a8a17..49615f8 100644 --- a/object/service.proto +++ b/object/service.proto @@ -166,7 +166,7 @@ service ObjectService { // * single message // * allows for additional header fields to be returned // - // Result is ordered by requested attributes and object ID. + // Result is ordered by the 1st requested attribute (if any) and object ID. rpc SearchV2(SearchV2Request) returns (SearchV2Response); // Get byte range of data payload. Range is set as an (offset, length) tuple. @@ -565,7 +565,7 @@ message SearchV2Request { // List of attribute names (including special ones as defined by // SearchFilter key) to include into the reply. Limited to 8, these - // attributes also affect result ordering (result is ordered by attributes + // attributes also affect result ordering (result is ordered by the 1st one // and then by OID). If additional attributes are requested, then the first // filter's key (see filters above) MUST be the first requested attribute. // '$Object:containerID' and '$Object:objectID' attributes are prohibited. diff --git a/proto-docs/object.md b/proto-docs/object.md index 7a6c8ec..90a30de 100644 --- a/proto-docs/object.md +++ b/proto-docs/object.md @@ -267,7 +267,7 @@ Search for objects in a container. Similar to Search, but: * single message * allows for additional header fields to be returned -Result is ordered by requested attributes and object ID. +Result is ordered by the 1st requested attribute (if any) and object ID. | Name | Input | Output | | ---- | ----- | ------ | @@ -837,7 +837,7 @@ Object Search request body | filters | [SearchFilter](#neo.fs.v2.object.SearchFilter) | repeated | List of search expressions. Limited to 8. If additional attributes are requested (see attributes below) then the first filter's key MUST be the first requested attribute. '$Object:containerID' and '$Object:objectID' filters are prohibited. | | cursor | [string](#string) | | Cursor to continue search. Can be omitted or empty for the new search. | | count | [uint32](#uint32) | | Limits the number of responses to the specified number. Can't be more than 1000. | -| attributes | [string](#string) | repeated | List of attribute names (including special ones as defined by SearchFilter key) to include into the reply. Limited to 8, these attributes also affect result ordering (result is ordered by attributes and then by OID). If additional attributes are requested, then the first filter's key (see filters above) MUST be the first requested attribute. '$Object:containerID' and '$Object:objectID' attributes are prohibited. | +| attributes | [string](#string) | repeated | List of attribute names (including special ones as defined by SearchFilter key) to include into the reply. Limited to 8, these attributes also affect result ordering (result is ordered by the 1st one and then by OID). If additional attributes are requested, then the first filter's key (see filters above) MUST be the first requested attribute. '$Object:containerID' and '$Object:objectID' attributes are prohibited. | From febb3bfec70840be46c5214abfcb5709a527a46d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 19 Feb 2025 16:01:22 +0300 Subject: [PATCH 2/2] object: Mention numeric limits for SearchV2 The selected range should cover all practical use cases for years to come. Refs #306. Signed-off-by: Leonard Lyubich --- object/service.proto | 3 ++- proto-docs/object.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/object/service.proto b/object/service.proto index 49615f8..9267a81 100644 --- a/object/service.proto +++ b/object/service.proto @@ -553,7 +553,8 @@ message SearchV2Request { // List of search expressions. Limited to 8. If additional attributes are // requested (see attributes below) then the first filter's key MUST be // the first requested attribute. '$Object:containerID' and - // '$Object:objectID' filters are prohibited. + // '$Object:objectID' filters are prohibited. Numeric filters' values MUST + // be in range [-MaxUint256, MaxUint256]. repeated SearchFilter filters = 3; // Cursor to continue search. Can be omitted or empty for the new search. diff --git a/proto-docs/object.md b/proto-docs/object.md index 90a30de..69ebce2 100644 --- a/proto-docs/object.md +++ b/proto-docs/object.md @@ -834,7 +834,7 @@ Object Search request body | ----- | ---- | ----- | ----------- | | container_id | [neo.fs.v2.refs.ContainerID](#neo.fs.v2.refs.ContainerID) | | Container where the search is being performed. | | version | [uint32](#uint32) | | Version of the Query Language used. | -| filters | [SearchFilter](#neo.fs.v2.object.SearchFilter) | repeated | List of search expressions. Limited to 8. If additional attributes are requested (see attributes below) then the first filter's key MUST be the first requested attribute. '$Object:containerID' and '$Object:objectID' filters are prohibited. | +| filters | [SearchFilter](#neo.fs.v2.object.SearchFilter) | repeated | List of search expressions. Limited to 8. If additional attributes are requested (see attributes below) then the first filter's key MUST be the first requested attribute. '$Object:containerID' and '$Object:objectID' filters are prohibited. Numeric filters' values MUST be in range [-MaxUint256, MaxUint256]. | | cursor | [string](#string) | | Cursor to continue search. Can be omitted or empty for the new search. | | count | [uint32](#uint32) | | Limits the number of responses to the specified number. Can't be more than 1000. | | attributes | [string](#string) | repeated | List of attribute names (including special ones as defined by SearchFilter key) to include into the reply. Limited to 8, these attributes also affect result ordering (result is ordered by the 1st one and then by OID). If additional attributes are requested, then the first filter's key (see filters above) MUST be the first requested attribute. '$Object:containerID' and '$Object:objectID' attributes are prohibited. |