Fixes problem with compiling queries with NOT expressions in them
Merge pull request #1716 from systay/not-rewrite

Fixes problem with compiling queries with NOT expressions in them