couchbaselabs / gojsonsm

Go implementation of my JSONSM algorithm.
9 stars 7 forks source link

Matcher does not execute the Afters in the top root node #77

Closed nelio2k closed 5 years ago

nelio2k commented 5 years ago

When the top level ExecNode contains Afters and does not get run, it could lead to incorrect results.

For example, something simple like: field0 < field1

would not be executed and the result would be incorrect.

brett19 commented 5 years ago

Can this not be implemented (depending on the desired logic) by simply converting an expression such as field1 < field2 into NOT (field1 >= field2) in order to allow the bintree to sort it out?

nelio2k commented 5 years ago

Is it to save the work of traversals of all the potential untouched Afters?

brett19 commented 5 years ago

Won't the bintree already handle this? The bintree already assumes all unchecked nodes are not matched, and NOT's have specialized handling to ensure they behave appropriately.

nelio2k commented 5 years ago

Right. So you're saying that if it's an operation on two fields, use the NOT operator and inverse the logic... and this way we don't have afters in the root?