Adds more sophisticated field queries supporting AND, NOT, and OR.

Includes new tests.