Skip to content

Commit

Permalink
add support for does not contain span filter operator (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
SrikarMannepalli authored Sep 1, 2023
1 parent 27095cc commit bafa898
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum RelationalOperator {
RELATIONAL_OPERATOR_EQUALS = 1;
RELATIONAL_OPERATOR_NOT_EQUALS = 2;
RELATIONAL_OPERATOR_CONTAINS = 3;
RELATIONAL_OPERATOR_NOT_CONTAINS = 8;
RELATIONAL_OPERATOR_STARTS_WITH = 4;
RELATIONAL_OPERATOR_ENDS_WITH = 5;
RELATIONAL_OPERATOR_REGEX_MATCH = 6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ private boolean matches(String lhs, String rhs, RelationalOperator relationalOpe
switch (relationalOperator) {
case RELATIONAL_OPERATOR_CONTAINS:
return lhs.contains(rhs);
case RELATIONAL_OPERATOR_NOT_CONTAINS:
return !lhs.contains(rhs);
case RELATIONAL_OPERATOR_EQUALS:
return lhs.equals(rhs);
case RELATIONAL_OPERATOR_NOT_EQUALS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ void testMatcher() {
buildSpanFilterValue("names"),
RelationalOperator.RELATIONAL_OPERATOR_CONTAINS));

assertFalse(
this.spanFilterMatcher.matches(
"name",
buildSpanFilterValue("nam"),
RelationalOperator.RELATIONAL_OPERATOR_NOT_CONTAINS));
assertTrue(
this.spanFilterMatcher.matches(
"name",
buildSpanFilterValue("names"),
RelationalOperator.RELATIONAL_OPERATOR_NOT_CONTAINS));

assertTrue(
this.spanFilterMatcher.matches(
"name", buildSpanFilterValue("name"), RelationalOperator.RELATIONAL_OPERATOR_EQUALS));
Expand Down

0 comments on commit bafa898

Please sign in to comment.