Move logic to build full query text in QueryBuilder