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

mango: add $beginsWith operator #4810

Merged
merged 11 commits into from
Oct 30, 2023
Merged

mango: add $beginsWith operator #4810

merged 11 commits into from
Oct 30, 2023

Commits on Oct 26, 2023

  1. mango: add $beginsWith operator

    Adds a `$beginsWith` operator to selectors, with json and text index
    support. This is a compliment / precursor to optimising `$regex`
    support as proposed in #4776.
    
    For `json` indexes, a $beginsWith operator translates into a key
    range query, as is common practice for _view queries. For example,
    to find all rows with a key beginning with "W", we can use a range
    `start_key="W", end_key="W\ufff0"`. Given Mango uses compound keys,
    this is slightly more complex in practice, but the idea is the same.
    As with other range operators (`$gt`, `$gte`, etc), `$beginsWith`
    can be used in combination with equality operators and result sorting
    but must result in a contiguous key range. That is, a range of
    `start_key=[10, "W"], end_key=[10, "W\ufff0", {}]` would be valid,
    but `start_key=["W", 10], end_key=["W\ufff0", 10, {}]` would not,
    because the second element of the key may result in a non-contiguous
    range.
    
    For text indexes, `$beginsWith` translates to a Lucene query on
    the specified field of `W*`.
    
    If a non-string operand is provided to `$beginsWith`, the request will
    fail with a 400 / `invalid_operator` error.
    willholley committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    1b05e0c View commit details
    Browse the repository at this point in the history
  2. add text eunit tests

    willholley committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    80378af View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0292f50 View commit details
    Browse the repository at this point in the history
  4. erlfmt fixes

    willholley committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    de1f012 View commit details
    Browse the repository at this point in the history
  5. use SubTest for sort tests

    willholley committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    bf2de99 View commit details
    Browse the repository at this point in the history
  6. Refactor generated tests

    willholley committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    c700f12 View commit details
    Browse the repository at this point in the history
  7. Fix lucene support

    willholley committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    3a94e00 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    b07e067 View commit details
    Browse the repository at this point in the history
  9. fixup eunit tests

    willholley committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    a5af777 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. address PR comments

    willholley committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    8e29e60 View commit details
    Browse the repository at this point in the history
  2. remove superfluous import

    willholley committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    5c88819 View commit details
    Browse the repository at this point in the history