get metadata in main query, calculate md5 hash in main query,