Fix an ODR violation consisting of two 'struct Query' in the global namespace.

Put them in their own anonymous namespaces. Found by GCC's new -Wodr (PR20915).