Adding more tests and helper functions for document mapping
Refactored query building in preparation for v1.13 changes
Finished refactoring ast building for v1.13 changes