Why can't we just always wrap solr.q in parentheses below, skipping this logic entirely? When in doubt, add extra parentheses to make sure we're getting the correct boolean statements. Solr handles it well. (((*:*) AND (field:val))) would work fine.