Query filtering (finally), refs #8.