Resolve query name automatically