Skip to content

Add numeric comparison operators to filters #237

@shaleenji

Description

@shaleenji

Problem Statement

The filter engine supports equality, $in, and $range, but users cannot write
common one-sided numeric predicates directly. Anyone filtering numeric metadata
has to translate queries like "age greater than 30" or "price less than 20" into
explicit range expressions, which is less ergonomic and easier to get wrong at
numeric boundaries.

Proposed Solution

Add public numeric comparison operators for scalar filters:

  • $lt
  • $lte
  • $gt
  • $gte

The operators should work for integer and float filter fields, preserve expected
equality-boundary behavior, handle negative values and zero, and compose with
the existing AND filter semantics. Boundary cases that cannot match anything,
such as $lt INT_MIN or $gt INT_MAX, should return an empty successful result.

Alternatives Considered

Keep requiring users to express comparison predicates as $range queries. This
avoids adding new operators, but pushes boundary handling and intent translation
onto every client.

Another option is to add only $range helpers in client SDKs. That improves SDK
ergonomics but leaves the HTTP/API contract less expressive and inconsistent
across clients.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions