Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object: Support numerical search queries #285

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

cthulhu-rider
Copy link
Contributor

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.

roman-khimov
roman-khimov previously approved these changes Jan 30, 2024
carpawell
carpawell previously approved these changes Jan 30, 2024
NUM_LT = 7;

// Numerical 'less or equal than'
NUM_LE = 8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NUM_EQUAL?

the previously added STRING_EQUAL / STRING_NOT_EQUAL matchers are suitable for numerical == / !=.

While it is true for now, it looks strange to me. Users should use STRING_EQUAL for numbers in their interfaces. Also, it is possible not to have strings-only values in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new values will be added when the existing ones are no longer sufficient

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this question as well, but as we're not supporting different notations ("1e8", for example) now, current set is sufficient for the purpose.

Copy link
Member

@carpawell carpawell Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my main point, i would say, in the naming of this message: MatchType (it is not bound to Filter), no info about what it relates to. i can imagine reusing this for a number representation of smth, then we will have to add NUM_EQUAL but we will already have had some users that will be using STRING_EQUAL, strange

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this enum is not intended to be reused. Imaginary importer will have to use it as it is, or will define it's own enum. Anyway, these are just numbers. Protocol inflation for the indefinite future is bad thing to do imo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this enum is not intended to be reused

but there are no words about what it is used for

@cthulhu-rider
Copy link
Contributor Author

rebased and CHANGELOGed

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 <leonard@morphbits.io>
@roman-khimov roman-khimov merged commit d5e1aad into master Feb 1, 2024
3 checks passed
@roman-khimov roman-khimov deleted the feature/265-search-match-num branch February 1, 2024 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Numeric search matches
3 participants