Add test for search beyond page 1. Add some query helpers.

Had to re-arrange and add/remove parts of the expected query as shown in the comments. I haven't looked into whether those alterations have any impact on the results.