-
Notifications
You must be signed in to change notification settings - Fork 68
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
clp-s: Add support for using "?" in wildcard queries on single-word values (resolves #392). #409
Changes from 1 commit
58909ce
539920a
bbc7b96
799f93d
187967a
6a90b55
d1e0eef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ class StringLiteral : public Literal { | |
m_string_type = LiteralType::VarStringT; | ||
} | ||
|
||
if (m_v.find('*') != std::string::npos) { | ||
if (m_v.find('*') != std::string::npos || m_v.find('?') != std::string::npos) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know it's wrong in the original code as well, but could we fix this to handle escaped There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right |
||
m_string_type |= LiteralType::ClpStringT; | ||
} | ||
} | ||
|
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.
Similar to my other comment we should be handling escaping here as well. Specifically if there are no unescaped
*
or?
we should enter this code block, process the string to unescape escaped characters as necessary, then do the precise search.E.g.
\\var\?
should enter this code block and get unescaped to become\var?
before performing exact match.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.
I think the function
wildcard_match_unsafe_case_sensitive
can handle escape characters correctly. The corner case was mentioned above and will be fixed later.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.
Right, but this code block uses
m_var_dict->get_entry_matching_value()
which doesn't respect escape characters.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.
Maybe for the condition here we can add a method like
and replace the if condition with
false == has_unescaped_wildcards(query)
?