Fix query_factory iterator bug, add Countable

- query_factory rewind() logic was incorrect
- added Countable implementation
Merge pull request #178 from drbyte/qf-iterator-countable

Fix query_factory iterator bug, add Countable