Skip to content

Commit

Permalink
A few comments here and there
Browse files Browse the repository at this point in the history
  • Loading branch information
msm-code committed Dec 15, 2022
1 parent 717573c commit f434d34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libursa/Query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,8 @@ Query Query::plan(const std::unordered_set<IndexType> &types_to_query) const {
return Query(*ngram);
}

auto ngrams = plan_qstring(types_to_query, value);
std::vector<Query> plans;
for (const auto gram : ngrams) {
for (const auto gram : plan_qstring(types_to_query, value)) {
plans.emplace_back(Query(gram));
}
return Query(QueryType::AND, std::move(plans));
Expand All @@ -290,6 +289,7 @@ Query Query::plan(const std::unordered_set<IndexType> &types_to_query) const {
plans.emplace_back(query.plan(types_to_query));
}

// Special case `1 of ...` (OR) and `n of (1, 2, ... n)` (AND).
if (type == QueryType::MIN_OF) {
if (count == 1) {
return Query(QueryType::OR, std::move(plans)).plan(types_to_query);
Expand All @@ -300,7 +300,7 @@ Query Query::plan(const std::unordered_set<IndexType> &types_to_query) const {
return Query(count, std::move(plans));
}

// For all other types (AND and OR), rewrite and simplify recursively
// For all other types (AND and OR), flatten and simplify recursively
std::vector<Query> new_plans;
for (auto it = plans.begin(); it != plans.end(); it++) {
if (it->type == type) {
Expand Down

0 comments on commit f434d34

Please sign in to comment.