ISSUE #34: Fix excessive number of query size() calls

I added an instance variable for the size of the query that gets cleared naturally by the container.