modified retrieval to use per-query samples