add support for scanning indexes, allow external callers to call generic queries