-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix wildcard query with escaped backslash followed by wildcard (#19719) #19756
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
Fix wildcard query with escaped backslash followed by wildcard (#19719) #19756
Conversation
|
❌ Gradle check result for bd3dcf8: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
…earch-project#19719) The getNonWildcardSequence method incorrectly handled cases where an escaped backslash was followed by a wildcard character. It would check if the character before a wildcard was a backslash, but didn't account for that backslash itself being escaped. For example, the query "*some\\*" (matching strings containing "some\") would incorrectly return "some\\*" instead of "some\\", causing invalid ngrams containing the wildcard character to be generated. The fix counts consecutive backslashes before wildcards: - Even count: wildcard is NOT escaped - Odd count: wildcard IS escaped Signed-off-by: Deven Prajapati <pdevens09@gmail.com> Signed-off-by: Deven009 <pdevens09@gmail.com>
bd3dcf8 to
95fe858
Compare
|
❌ Gradle check result for 95fe858: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Deven009 <pdevens09@gmail.com>
Signed-off-by: Deven009 <37845204+Deven009@users.noreply.github.com>
|
❕ Gradle check result for d2a4ad5: UNSTABLE Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19756 +/- ##
============================================
+ Coverage 73.15% 73.49% +0.33%
- Complexity 71118 71439 +321
============================================
Files 5754 5754
Lines 325298 325304 +6
Branches 47052 47054 +2
============================================
+ Hits 237975 239067 +1092
+ Misses 68154 67295 -859
+ Partials 19169 18942 -227 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jainankitk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Maybe @msfroh can take another look before merging it
|
Thank you @jainankitk for reviewing it. |
msfroh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks, @Deven009!
|
Not sure why the "assemble" and "precommit" steps for JDK21 on macos-15 are still pending. @Deven009 -- if they don't start running in the next ~1 hour, can you please close and reopen the PR? (That is, just click "Close pull request" at the bottom of this page, followed by "Reopen pull request".) That will retrigger all of the checks. Worst case, if the Gradle Check step fails, we can retry it. |
|
Thank you for your review @msfroh |
…earch-project#19719) (opensearch-project#19756) The getNonWildcardSequence method incorrectly handled cases where an escaped backslash was followed by a wildcard character. It would check if the character before a wildcard was a backslash, but didn't account for that backslash itself being escaped. For example, the query "*some\\*" (matching strings containing "some\") would incorrectly return "some\\*" instead of "some\\", causing invalid ngrams containing the wildcard character to be generated. The fix counts consecutive backslashes before wildcards: - Even count: wildcard is NOT escaped - Odd count: wildcard IS escaped --------- Signed-off-by: Deven Prajapati <pdevens09@gmail.com> Signed-off-by: Deven009 <pdevens09@gmail.com> Signed-off-by: Deven009 <37845204+Deven009@users.noreply.github.com>
Description
The getNonWildcardSequence method incorrectly handled cases where an escaped backslash was followed by a wildcard character. It would check if the character before a wildcard was a backslash, but didn't account for that backslash itself being escaped.
For example, the query "some\" (matching strings containing "some") would incorrectly return "some\*" instead of "some\", causing invalid ngrams containing the wildcard character to be generated.
The fix counts consecutive backslashes before wildcards:
Related Issues
Resolves #19719
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.