diff options
Diffstat (limited to 'lib/filter.cpp')
-rw-r--r-- | lib/filter.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/lib/filter.cpp b/lib/filter.cpp index 17309f1..ceb9327 100644 --- a/lib/filter.cpp +++ b/lib/filter.cpp | |||
@@ -1283,7 +1283,9 @@ namespace verbly { | |||
1283 | { | 1283 | { |
1284 | filter normalized = child.normalize(context); | 1284 | filter normalized = child.normalize(context); |
1285 | 1285 | ||
1286 | // Notably, this does not attempt to merge hierarchal matches. | 1286 | // Notably, this does not attempt to merge hierarchal matches, |
1287 | // UNLESS they are positive matches being OR-d, or negative | ||
1288 | // matches being ANDed. | ||
1287 | switch (normalized.getType()) | 1289 | switch (normalized.getType()) |
1288 | { | 1290 | { |
1289 | case type::singleton: | 1291 | case type::singleton: |
@@ -1306,7 +1308,7 @@ namespace verbly { | |||
1306 | { | 1308 | { |
1307 | if (!negativeJoins.count(normalized.singleton_.filterField)) | 1309 | if (!negativeJoins.count(normalized.singleton_.filterField)) |
1308 | { | 1310 | { |
1309 | negativeJoins[normalized.getField()] = filter(group_.orlogic); | 1311 | negativeJoins[normalized.getField()] = filter(!group_.orlogic); |
1310 | } | 1312 | } |
1311 | 1313 | ||
1312 | negativeJoins.at(normalized.getField()) += std::move(*normalized.singleton_.join); | 1314 | negativeJoins.at(normalized.getField()) += std::move(*normalized.singleton_.join); |
@@ -1314,6 +1316,30 @@ namespace verbly { | |||
1314 | break; | 1316 | break; |
1315 | } | 1317 | } |
1316 | 1318 | ||
1319 | case comparison::hierarchally_matches: | ||
1320 | { | ||
1321 | if (group_.orlogic) | ||
1322 | { | ||
1323 | positiveJoins[normalized.getField()] |= std::move(*normalized.singleton_.join); | ||
1324 | } else { | ||
1325 | result += std::move(normalized); | ||
1326 | } | ||
1327 | |||
1328 | break; | ||
1329 | } | ||
1330 | |||
1331 | case comparison::does_not_hierarchally_match: | ||
1332 | { | ||
1333 | if (!group_.orlogic) | ||
1334 | { | ||
1335 | negativeJoins[normalized.getField()] |= std::move(*normalized.singleton_.join); | ||
1336 | } else { | ||
1337 | result += std::move(normalized); | ||
1338 | } | ||
1339 | |||
1340 | break; | ||
1341 | } | ||
1342 | |||
1317 | case comparison::int_equals: | 1343 | case comparison::int_equals: |
1318 | case comparison::int_does_not_equal: | 1344 | case comparison::int_does_not_equal: |
1319 | case comparison::int_is_at_least: | 1345 | case comparison::int_is_at_least: |
@@ -1327,8 +1353,6 @@ namespace verbly { | |||
1327 | case comparison::string_is_not_like: | 1353 | case comparison::string_is_not_like: |
1328 | case comparison::is_null: | 1354 | case comparison::is_null: |
1329 | case comparison::is_not_null: | 1355 | case comparison::is_not_null: |
1330 | case comparison::hierarchally_matches: | ||
1331 | case comparison::does_not_hierarchally_match: | ||
1332 | { | 1356 | { |
1333 | result += std::move(normalized); | 1357 | result += std::move(normalized); |
1334 | 1358 | ||