Prevent empty meta queries by filtering. Closes #2978.