Optimize query by wrapping top-level OR

See #3, thanks @fatalmind