Query planner cleanups.

Including short-circuiting to query terms.
Merge pull request #90 from nsabovic/moqp

Query planner cleanups.