This commit is contained in:
Alex Roitman 2019-06-13 12:04:04 -07:00
parent 3ded4e3a44
commit 0c3a5d02ca
2 changed files with 11 additions and 12 deletions

View File

@ -724,10 +724,10 @@ loop:
newExpr := &areaExpression{negate: negate, op: NOOP}
negate = false
if ae != nil {
ps.push(ae)
ae.children = append(ae.children, newExpr)
}
ae = newExpr
ps.push(ae)
vsout = nvs
case tokenRParen:
if negate {
@ -788,14 +788,7 @@ loop:
err = errInvalidNumberOfArguments
return
} else {
parent, empty := ps.pop()
if empty {
parent = ae
}
parent.children = append(
parent.children,
&areaExpression{op: OR})
ps.push(parent)
ae = &areaExpression{op: OR, children: []*areaExpression{ae}}
}
case NOOP:
ae.op = OR
@ -826,8 +819,5 @@ loop:
break loop
}
}
if prevExpr, empty := ps.pop(); !empty {
ae = prevExpr
}
return
}

View File

@ -149,6 +149,15 @@ func testcmd_expression_test(mc *mockServer) error {
{"TEST", "OBJECT", poly9, "INTERSECTS", "GET", "mykey", "poly8", "AND",
"(", "OBJECT", poly, "AND", "NOT", "GET", "mykey", "line3", ")"}, {"1"},
{"TEST", "OBJECT", poly9, "INTERSECTS", "NOT", "GET", "mykey", "line3"}, {"1"},
{"TEST", "NOT", "OBJECT", poly9, "INTERSECTS", "GET", "mykey", "line3"}, {"1"},
{"TEST", "OBJECT", poly9, "INTERSECTS", "GET", "mykey", "line3",
"OR", "OBJECT", poly8, "AND", "OBJECT", poly}, {"1"},
{"TEST", "OBJECT", poly9, "INTERSECTS", "OBJECT", poly8, "AND", "OBJECT", poly,
"OR", "GET", "mykey", "line3"}, {"1"},
{"TEST", "OBJECT", poly9, "INTERSECTS", "GET", "mykey", "line3", "OR",
"(", "OBJECT", poly8, "AND", "OBJECT", poly, ")"}, {"1"},
{"TEST", "OBJECT", poly9, "INTERSECTS",
"(", "GET", "mykey", "line3", "OR", "OBJECT", poly8, ")", "AND", "OBJECT", poly}, {"1"},
{"TEST", "OBJECT", poly9, "WITHIN", "OBJECT", poly8, "OR", "OBJECT", poly}, {"1"},
{"TEST", "OBJECT", poly9, "WITHIN", "OBJECT", poly8, "AND", "OBJECT", poly}, {"1"},