- 
                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
base: main
Are you sure you want to change the base?
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 <[email protected]> Signed-off-by: Deven009 <[email protected]>
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 <[email protected]>
Signed-off-by: Deven009 <[email protected]>
| 
           ❕ 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.19%   +0.04%     
- Complexity    71118    71168      +50     
============================================
  Files          5754     5754              
  Lines        325298   325304       +6     
  Branches      47052    47054       +2     
============================================
+ Hits         237975   238111     +136     
+ Misses        68154    68052     -102     
+ Partials      19169    19141      -28     ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
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
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.