added general query utility (used by secex and rais for now)