Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
31 changes: 10 additions & 21 deletions components/core/src/clp_s/search/QueryRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "ast/Literal.hpp"
#include "ast/OrExpr.hpp"
#include "ast/SearchUtils.hpp"
#include "clp_search/EncodedVariableInterpreter.hpp"
#include "clp_search/Grep.hpp"
#include "EvaluateTimestampIndex.hpp"

Expand Down Expand Up @@ -868,7 +867,7 @@ void QueryRunner::populate_string_queries(std::shared_ptr<Expression> const& exp
)
);
}
SubQuery sub_query;

if (filter->get_column()->matches_type(LiteralType::VarStringT)) {
std::string query_string;
filter->get_operand()->as_var_string(query_string, filter->get_operation());
Expand Down Expand Up @@ -899,25 +898,15 @@ void QueryRunner::populate_string_queries(std::shared_ptr<Expression> const& exp
for (auto const& entry : entries) {
matching_vars.insert(entry->get_id());
}
} else if (EncodedVariableInterpreter::
wildcard_search_dictionary_and_get_encoded_matches(
query_string,
*m_var_dict,
m_ignore_case,
sub_query
))
{
for (auto const& var : sub_query.get_vars()) {
if (var.is_precise_var()) {
auto const* entry = var.get_var_dict_entry();
if (entry != nullptr) {
matching_vars.insert(entry->get_id());
}
} else {
for (auto const* entry : var.get_possible_var_dict_entries()) {
matching_vars.insert(entry->get_id());
}
}
} else {
std::unordered_set<VariableDictionaryEntry const*> matching_entries;
m_var_dict->get_entries_matching_wildcard_string(
query_string,
m_ignore_case,
matching_entries
);
for (auto const& entry : matching_entries) {
matching_vars.emplace(entry->get_id());
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion components/core/tests/test-clp_s-search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ TEST_CASE("clp-s-search", "[clp-s][search]") {
{R"aa(idx: 0 AND NOT $*._filename.*: "clp string")aa", {0}},
{R"aa(($_filename: file OR $_file_split_number: 1 OR $_archive_creator_id > 0) AND )aa"
R"aa(idx: 0 OR idx: 1)aa",
{1}}
{1}},
{R"aa(ambiguous_varstring: "a*e")aa", {10, 11, 12}},
{R"aa(ambiguous_varstring: "a\*e")aa", {12}}
};
auto structurize_arrays = GENERATE(true, false);
auto single_file_archive = GENERATE(true, false);
Expand Down
3 changes: 3 additions & 0 deletions components/core/tests/test_log_files/test_search.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
{"idx": 7, "arr": [{"a": 999}, {"b": 1001}]}
{"idx": 8, "arr": {"a": 999, "b": 1001}}
{"idx": 9, "var_string": "a", "clp_string": "a b", "float": 1.1, "int": 1, "bool": true, "array": [], "object": {}}
{"idx": 10, "ambiguous_varstring": "abcde"}
{"idx": 11, "ambiguous_varstring": "ae"}
{"idx": 12, "ambiguous_varstring": "a*e"}
Loading