flip merge-query and merge internals