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

clp-s: Add support for using "?" in wildcard queries on single-word values (resolves #392). #409

Merged
merged 7 commits into from
May 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
apply suggestions from code review
  • Loading branch information
wraymo committed May 16, 2024
commit 539920ad0c76f7373075e0633490220ab480b3c8
15 changes: 13 additions & 2 deletions components/core/src/clp_s/search/StringLiteral.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,19 @@ class StringLiteral : public Literal {
m_string_type = LiteralType::VarStringT;
}

if (m_v.find('*') != std::string::npos || m_v.find('?') != std::string::npos) {
m_string_type |= LiteralType::ClpStringT;
// If '?' and '*' are not escaped, we add LiteralType::ClpStringT to m_string_type
bool escape = false;
for (char const c : m_v) {
if ('\\' == c) {
escape = !escape;
} else if ('?' == c || '*' == c) {
if (!escape) {
m_string_type |= LiteralType::ClpStringT;
break;
}
} else {
escape = false;
}
}
}
};
Expand Down
Loading