Skip to content

[MOD-9547] Implement wildcard matching, as a preliminary step towards wildcard trie iterators.#6000

Merged
LukeMathWalker merged 11 commits intomasterfrom
wildcard-rs
Apr 28, 2025
Merged

[MOD-9547] Implement wildcard matching, as a preliminary step towards wildcard trie iterators.#6000
LukeMathWalker merged 11 commits intomasterfrom
wildcard-rs

Conversation

@LukeMathWalker
Copy link
Collaborator

@LukeMathWalker LukeMathWalker commented Apr 23, 2025

Describe the changes in the pull request

This PR covers wildcard matching. It is the first of a series of PRs aimed at breaking #5928 down into smaller (and easier to review) chunks.

Wildcard matching is implemented as a standalone crate, named wildcard.
It mirrors the functionality provided by src/wildcard.*, restricted to c_char (for now). The test suite in tests/ctests/test_wildcard.c has been ported over to Rust too, alongside new test cases (e.g. property-based tests).

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

@LukeMathWalker LukeMathWalker marked this pull request as ready for review April 23, 2025 14:46
@codecov
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

Attention: Patch coverage is 97.26027% with 4 lines in your changes missing coverage. Please review.

Project coverage is 87.48%. Comparing base (968c80e) to head (75d05c3).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/redisearch_rs/wildcard/src/lib.rs 96.46% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6000      +/-   ##
==========================================
+ Coverage   87.44%   87.48%   +0.03%     
==========================================
  Files         217      219       +2     
  Lines       39359    39505     +146     
  Branches     2634     2780     +146     
==========================================
+ Hits        34419    34559     +140     
- Misses       4931     4937       +6     
  Partials        9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LukeMathWalker LukeMathWalker force-pushed the wildcard-rs branch 3 times, most recently from 391f1f2 to 5d4c6b0 Compare April 24, 2025 12:41
DarthB
DarthB previously requested changes Apr 25, 2025
Copy link
Contributor

@DarthB DarthB left a comment

Choose a reason for hiding this comment

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

My main concern is the missing handlng of ' as escape character. Besides that it look good overall.

I wonder why you decided for intgration tests, instead of unit tests? Even with proptests this feels lightweight.

@DarthB
Copy link
Contributor

DarthB commented Apr 25, 2025

Just realized, I have an untracked src/redisearch_rs/wildcard/tests/proptest-regressions/properties.txt file now --> .gitignore

@LukeMathWalker
Copy link
Collaborator Author

LukeMathWalker commented Apr 28, 2025

My main concern is the missing handlng of ' as escape character. Besides that it look good overall.

' is not an escape character, contrary to what the documentation suggests.
I've opened a PR to amend the documentation to match the implementation.

I wonder why you decided for intgration tests, instead of unit tests? Even with proptests this feels lightweight.

In this case, all functions are public, so there is no difference between unit tests and integration tests.
Test coverage for this patch is, if you disregard the code for std::fmt::Debug, 100%. It also includes the original C test suite as a subset of the tested cases.
What specifically would you add to improve the quality of the test suite here?

if wc_cf.is_match(&key) {
matches!(&input.pattern, [&key])
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe there a nice way to check the no_match cases?
no_match -> cloudflare no match

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done in ce46e13!

@LukeMathWalker LukeMathWalker changed the title [MOD-8973] Implement wildcard matching, as a preliminary step towards wildcard trie iterators. [MOD-9547] Implement wildcard matching, as a preliminary step towards wildcard trie iterators. Apr 28, 2025
Copy link
Collaborator

@BenGoldberger BenGoldberger left a comment

Choose a reason for hiding this comment

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

overall looks good, there are a few comments.

@LukeMathWalker LukeMathWalker added this pull request to the merge queue Apr 28, 2025
Merged via the queue into master with commit 1511262 Apr 28, 2025
13 checks passed
@LukeMathWalker LukeMathWalker deleted the wildcard-rs branch April 28, 2025 13:11
nafraf pushed a commit that referenced this pull request May 13, 2025
… wildcard trie iterators. (#6000)

* [MOD-8973] Implement wildcard matching, as a preliminary step towards wildcard trie iterators.

* Use a different slicing style

* Add proptest-regressions to gitignore

* Boost parse documentation to clarify how escaping and simplifications work

* Clarify comment

* Remove duplicated test case

* Implement Display and Debug for all public types

* Combine `matches` and `matches_fixed_len` into a single function,
without losing the short-circuiting optimization for patterns
with a known expected length.

Microbenchmarks have been added to confirm that we don't
compromise performance.

* When Cloudflare doesn't match, we don't match either.

* Don't spell check the benchmarks

* Test the formatted representations
JoanFM pushed a commit that referenced this pull request May 27, 2025
… wildcard trie iterators. (#6000)

* [MOD-8973] Implement wildcard matching, as a preliminary step towards wildcard trie iterators.

* Use a different slicing style

* Add proptest-regressions to gitignore

* Boost parse documentation to clarify how escaping and simplifications work

* Clarify comment

* Remove duplicated test case

* Implement Display and Debug for all public types

* Combine `matches` and `matches_fixed_len` into a single function,
without losing the short-circuiting optimization for patterns
with a known expected length.

Microbenchmarks have been added to confirm that we don't
compromise performance.

* When Cloudflare doesn't match, we don't match either.

* Don't spell check the benchmarks

* Test the formatted representations
JoanFM pushed a commit that referenced this pull request May 27, 2025
… wildcard trie iterators. (#6000)

* [MOD-8973] Implement wildcard matching, as a preliminary step towards wildcard trie iterators.

* Use a different slicing style

* Add proptest-regressions to gitignore

* Boost parse documentation to clarify how escaping and simplifications work

* Clarify comment

* Remove duplicated test case

* Implement Display and Debug for all public types

* Combine `matches` and `matches_fixed_len` into a single function,
without losing the short-circuiting optimization for patterns
with a known expected length.

Microbenchmarks have been added to confirm that we don't
compromise performance.

* When Cloudflare doesn't match, we don't match either.

* Don't spell check the benchmarks

* Test the formatted representations
@LukeMathWalker LukeMathWalker restored the wildcard-rs branch February 6, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants